mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 12:14:43 +00:00
Rename dir: compiler
-> crates
This commit is contained in:
parent
e1004b538d
commit
a127564b31
221 changed files with 17 additions and 19 deletions
21
crates/erg_compiler/lib/std/_erg_control.py
Normal file
21
crates/erg_compiler/lib/std/_erg_control.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
def if__(cond, then, else_=lambda: None):
|
||||
if cond:
|
||||
return then()
|
||||
else:
|
||||
return else_()
|
||||
|
||||
def for__(iterable, body):
|
||||
for i in iterable:
|
||||
body(i)
|
||||
|
||||
def while__(cond_block, body):
|
||||
while cond_block():
|
||||
body()
|
||||
|
||||
def with__(obj, body):
|
||||
obj.__enter__()
|
||||
body(e)
|
||||
obj.__exit__()
|
||||
|
||||
def discard__(obj):
|
||||
pass
|
Loading…
Add table
Add a link
Reference in a new issue