blob: b594a0faad7d619b75d993eed535f81280c66142 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# Variables must be snake_case.
let hello_world = "Hello, world"
# Define a global variable, accessible anywhere. It is put on its own stack.
global hello_world = "Poggers"
let num = 5
if num % 2 == 0:
core:log("fair")
else:
core:log("strange")
end
loop:
# infinite loop
break
end
loop num > 0:
# conditional loop
if num == 4:
num = 3
next # equivalent to continue in other languages
end
num -= 1
end
let list = [1, 2, 5, 4]
loop i in arr:iter(list):
# iterator loop
core:log(i)
end
fun main:init()
end
fun sum(a, b)
ret a + b
fun print_sum(a, b)
let val = sum(a, b)
core:log(val)
end
do:
# Standalone scope
let a = 1
core:log(a)
end
|