Skip to main content

Declarations

Declarations let you assign a value to a variable:
x = 2

var = 25

y = x^2^ - 6x + 2
The syntax is: {var name} = {expression} This makes the variable have the same value as the evaluated expression on the right. It allows for reassignment later on (mutable variable):
# first assignment
x = 2

# second assignment
x = 3

# perfectly valid!

y = x
# y now resolves to 3

Definitions

Definitions act exactly the same as declarations, but once the variable is assigned the value, the variable becomes immutable and it cannot be changed. The syntax is: {var name} == {expression}
n == 6.62

# n cannot be changed anymore

# error
n == 4

# error
n = 3

# but it still can be used and even moved
n * 7 

b = n
b = 3
# valid!

Locking

Locking is the practice of making a mutable variable, immutable. It is done by:
# initial assignment
x = 3

# locking
x == x