iyi

Playground · Basics · 4 of 33

variables

Variables: assign a value and the type follows.

samples/tour/variables.iyi · variables.wasm · 151 KB
# Variables: assign a value and the type follows.

name = "iyi"
year = 2026
ratio = 0.75
ready = true

puts name
puts year
puts ratio
puts ready

# A variable keeps its type. You can reassign, but not to a different kind.
year = year + 1
puts year

# Write the type when you want to be explicit.
count : Int32 = 10
puts count
output
Press Run.

recorded with iyi 0.18.0 (built on Crystal 1.22.0-dev [2a9653052] (2026-10-18)) · Linux 7.0.0-38-generic x86_64, QEMU Virtual CPU version 2.5+ · 2026-10-19

You can type in the pane: nothing here compiles, so what you type cannot run, and the page says which bytes it is running the moment the text stops being the recorded file. There is no standard input, no filesystem and no threads on this target, and one sample fails on purpose for exactly that reason.

Run executes variables.wasm, the module the compiler built from this file, in your browser. How this works

Try it on your machine

Copy the program into variables.iyi, change something, and run it. Only a compiler on your own machine can run what you wrote.

sh, after installing
$ iyi run variables.iyi