mirror of
https://github.com/erg-lang/erg.git
synced 2025-07-07 21:25:31 +00:00
31 lines
477 B
Python
31 lines
477 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
|
|
_ = match a:
|
|
(_: {1}) -> 1
|
|
(_: 0..1) -> 100
|
|
(i: Int) -> i
|
|
(s: Str) -> 1
|
|
_ -> panic "unknown object"
|
|
|
|
for! 0..<10, i =>
|
|
print! "i = \{i}"
|
|
|
|
counter = !10
|
|
print! counter
|
|
while! do!(not(counter == 0)), do!:
|
|
print! "counter = \{counter}"
|
|
counter.dec!()
|
|
|
|
x = 1
|
|
Del x
|