If|if_then_«else if_then_»«else_»?

Definitions:

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 true. If none of the predicates answer true, 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 true.
3 elseIfTuple <<[]→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 true.
4 else ([]→⊤)? 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.
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 true. If none of the predicates answer true, 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 true.
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.

Semantic restrictions:

boolean's type, []→⊤'s type, <<[]→boolean, []→⊤…|2>…|1..>'s type, ([]→⊤)?'s type
Source: /avail/Avail/Foundation/Control Structures
Provide the strongest possible return type. If no else action is provided, but the chain of predicates does not definitely indicate a particular action, then answer ⊤. The weakest possible (but actual) strengthening is the type union of the return types of all actions whose associated predicates are not guaranteed to answer false. The greatest possible strengthening occurs when an action whose predicate is guaranteed to answer true is preceded only by actions whose predicates are guaranteed to answer false; in this case, answer this action's return type.
Type Description
Parameter Types
boolean's type
[]→⊤'s type
<<[]→boolean, []→⊤…|2>…|1..>'s type
([]→⊤)?'s type