Declaring and using variables with let
// Tutorial 02: Variables
// Declaring and using variables with let
just run {
let name = "Krypton"
let version = 1
let greeting = "Welcome to " + name + " v" + version
kp(greeting)
// Variables can be reassigned
name = "Krypton Language"
kp("Now using: " + name)
}
Click ▶ Run to execute. Lessons using k:fs/k:http/match/struct need the real runtime.
Tip: this code box is editable — tweak it, then hit Run, or copy into a .k file and run locally.
Run it locally: kcc -r tutorial/02_variables.k