HANDBOOK / GENTLE PRIMER / Control Structures /

The Conditional Statement

A frequent case is that, if a certain condition holds, a specific action should be initiated, otherwise nothing should happen. This could be expressed by an alternative statement with an empty second alternative.

For example,


   (|  IsBad(Item) Complain(Item) || /*nothing*/ |)
This can be abbreviated by a conditional statement.

   [|  IsBad(Item) Complain(Item) |]
An alternative statement has the form The members Mi are elaborated in the given order. If one member fails elaboration is completed and and the conditional statement succeeds. If all members succeed the conditional statement succeeds.

A conditional statement cannot define variables because if one member fails its conceptual empty second case is taken which defines no variables.