This page presents the computation operators that allow a choice depending on some condition. All possible returned values must be of the same type.
(if_else [BOOL] [C0 = COMPUTATION] [C1 = COMPUTATION])
Returns C0
is [BOOL]
yields true, C1
otherwise.
(cond
([B0 = BOOL] [C0 = COMPUTATION])
...
([BN = BOOL] [CN = COMPUTATION])
)
Returns [CI]
, such that [BI]
is the first to hold true. If there is not such
Bi
, returns [CN]
.
(switch [T = COMPUTATION]
([V0 = COMPUTATION] [C0 = COMPUTATION])
...
([VN = BOOL] [CN = COMPUTATION])
[D = COMPUTATION]
)
a
Returns the first CI
such that VI
is equal to T
. If there is not such
VI
, returns [D]
.
(cond
((false) (false))
((false) (false))
((true)
(cond
((false) (false))
((true) (not (is_member 3 test_list)))
((true) (false))
)
)
)
(switch 3
(0 (false))
(1 (false))
(3 (true))
(2 (false))
(false)
)
(if_else (true)
(if_else (false)
(assert (false) FAILED: instruction ifelse E)
(set test_var (true))
)
(assert (false) FAILED: instruction ifelse F)
)