code / tomo-koans

Lines447 Tomo432 INI9 Markdown6
(26 lines)
1 # Variables
3 func main()
5 # Variable declarations use `:=` and do not
6 # require you to specify a type explicitly:
7 x := 123
9 # To assign a new value, use `=`
10 x = 999
12 # You can also use update assignments like `+=`
13 x += 1
15 assert x == 1000
17 # Variables are strongly typed, so you can't
18 # assign different types to the same variable:
19 x = "hello" # <-- This will error, comment it out or fix it
21 # Declare a variable called `y` and give it the
22 # value "okay"
24 ???
26 assert y == "okay"