lang_2023/tests/flow_control.lang

35 lines
506 B
Text
Raw Normal View History

2023-03-31 12:10:12 +03:00
decl flow_control_test : Unit -> Unit
def flow_control_test = {
if ((a < b) || (a == b)) && (b < c) then IO.print: x
elif x < 0 then {
2023-03-31 12:10:12 +03:00
; ++x
; IO.print: y
2023-03-31 12:10:12 +03:00
} else {
return {}
}
while (a > 0) && (!array.is_empty:) do {
2023-03-31 12:10:12 +03:00
; --a
; array.pop:
2023-03-31 12:10:12 +03:00
}
while x < 10 do
x += x + 3
for i in 0..y do {
; IO.print: i
2023-03-31 12:10:12 +03:00
}
for & i & j in (& 0..y & 0..k) do {
; IO.print: 1
; IO.print: 2
; IO.print: 128
2023-03-31 12:10:12 +03:00
}
loop {
; ++y
if y > 100 then
break
}
}