This commit is contained in:
ProgramSnail 2023-03-31 12:10:12 +03:00
parent 582ad5668e
commit 0d62ae0814
29 changed files with 99479 additions and 1166 deletions

44
tests/flow_control.lang Normal file
View file

@ -0,0 +1,44 @@
decl flow_control_test : Unit -> Unit
def flow_control_test = {
// if && || a < b
// || a == b
// && b < c
// && c > 10
if ((a < b) || (a == b)) && (b < c)
then IO.print x
elif x < 0
then {
; ++x
; IO.print y
} else {
return {}
}
while (a > 0) && (!array.is_empty)
do {
; --a
; array.pop
}
while x < 10 do
x += x + 3
for i in 0..y do {
; IO.print i
}
for & i & j
in (& 0..y & 0..k)
do { // TODO: decide ??? does it work (like auto zip) ???
; IO.print 1
; IO.print 2
; IO.print 128
}
loop {
; ++y
if y > 100 then
break
}
}