expression phrase ⇒ boolean, expression phrase ⇒ []→⊤, list phrase ⇒ (<boolean, []→⊤…|2>+), list phrase ⇒ (([]→⊤)?)
Source: /avail/Avail/Foundation/Control Structures
Categories: Control Structures, Conditionals
Multiply branching conditional statement/expression. Execute the first action for which the associated predicate answers false. If none of the predicates answer false, then execute the else action. If no else action is provided, then do not execute any of the action blocks.
Position | Name | Type | Description | |
---|---|---|---|---|
Parameters | ||||
1 | firstPredicate | expression phrase ⇒ boolean | The first predicate to check. | |
2 | firstThen | expression phrase ⇒ []→⊤ | The action to perform if firstPredicate is false. | |
3 | elseIfTuple | list phrase ⇒ (<boolean, []→⊤…|2>+) | A lexically constructed tuple of 2-tuples. Each 2-tuple has as its first element a predicate and as its second element an action to perform if the predicate answers true. | |
4 | else | list phrase ⇒ (([]→⊤)?) | A lexically constructed tuple that optionally contains the action to perform if firstPredicate is false and all predicates of elseIfTuple answer false. | |
Returns | ⊤ | If used as an expression, then the value of the selected action. |
boolean, []→⊤, <<[]→boolean, []→⊤…|2>…|1..>, ([]→⊤)?
Source: /avail/Avail/Foundation/Control Structures
Categories: Control Structures, Conditionals
Multiply branching conditional statement/expression. Execute the first action for which the associated predicate answers false. If none of the predicates answer false, then execute the else action. If no else action is provided, then do not execute any of the action blocks.
Position | Name | Type | Description | |
---|---|---|---|---|
Parameters | ||||
1 | firstPredicate | boolean | The first predicate. This argument is a raw boolean rather than a function answering a boolean, because it must always be evalutated (and hence there is no point deferring its evaluation). | |
2 | firstThen | []→⊤ | The action to perform if firstPredicate is false. | |
3 | elseUnlessTuple | <<[]→boolean, []→⊤…|2>…|1..> | A lexically constructed tuple of 2-tuples. Each 2-tuple has as its first element a predicate function and as its second element an action to perform if the predicate function answers false. | |
4 | else | ([]→⊤)? | A lexically constructed tuple that optionally contains the action to perform if firstPredicate is true and all predicates of elseIfTuple answer true. | |
Returns | ⊤ | If used as an expression, then the value of the selected action. |