mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 20:14:45 +00:00
29 lines
526 B
Python
29 lines
526 B
Python
cond = True
|
|
s = if cond:
|
|
do "then block"
|
|
do "else block"
|
|
assert s == "then block"
|
|
|
|
if! cond:
|
|
do!:
|
|
print! "then block!"
|
|
do!:
|
|
print! "else block!"
|
|
|
|
a = [1, 2, 3]
|
|
sum = match a:
|
|
[x, y, z] -> x + y + z
|
|
(x, y, z) -> x + y + z
|
|
{x; y; z} -> x + y + z
|
|
(i: Int) -> i
|
|
_ -> panic "unknown object"
|
|
|
|
for! 0..<1000, i =>
|
|
print! "i = {i}"
|
|
if i >= 100:
|
|
do return break()
|
|
|
|
counter = !100
|
|
while! not counter.is_zero(), do!:
|
|
print! "counter = {counter}"
|
|
counter.dec!()
|