-
Notifications
You must be signed in to change notification settings - Fork 119
Multiple condition
Wang Renxin edited this page May 31, 2022
·
3 revisions
The language itself only offers conditional execution with the IF
statements. Furthermore, it's possible to implement a SELECT
statement as routine for multiple conditions.
def select(...)
l = len(...)
for i = 0 to l - 1 step 2
if ... then
_ = ...
_()
return
else
_ = ...
endif
next
enddef
This routine accepts variadic, which come with a sequence of condtion0
, invokable0
, condtion1
, invokable1
... For example:
input i
select
(
i = 1, lambda () (print "One";),
i = 2, lambda () (print "Two";),
i >= 3, lambda () (print "Many";)
)
- Principles
- Coding
- Data types
- Standalone shell
- Integration
- Customization
- More scripting API
- FAQ