21 lines
579 B
Plaintext
21 lines
579 B
Plaintext
(macro if2 (conds bothConditionsAreTrue firstConditionIsTrue secondConditionIsTrue noConditionIsTrue) {
|
|
# Assuming 'conds' is a node with at least 2 subnodes.
|
|
# Get its content and evaluate it once, to be able to
|
|
# refer to it without reevaluating the conditions
|
|
(let result1 (head conds))
|
|
(let result2 (@ conds 1))
|
|
|
|
(if (and result1 result2)
|
|
bothConditionsAreTrue
|
|
(if result1
|
|
firstConditionIsTrue
|
|
(if result2
|
|
secondConditionIsTrue
|
|
noConditionIsTrue)))})
|
|
|
|
(if2 (true false)
|
|
(print "1")
|
|
(print "2")
|
|
(print "3")
|
|
(print "4"))
|