Variables

Declaration


In [24]:
x = 10
println(x)
#Variables are case sensitive
X = 20
println(X)
#Unicode characters are valid as variable names
 = 30
println()


10
20
30

Math with variables


In [25]:
y = x+1
t = x + y
f = t - y
println("$y,$t,$f")


11,21,10

Reasigment


In [26]:
x = 1 + 1
println(x)
#Built in constants can be rewritten
println(pi)
pi = 4
println(pi)


2
π = 3.1415926535897...
4
WARNING: imported binding for pi overwritten in module Main

In [ ]: