Follow project on Twitter

2.2 Selections

Natural language also contains selections, such as in the sentence, “If a traffic light is yellow or red, you must stop.”. Under the condition “A traffic light is yellow or red.” the action “You must stop.” applies here.

Often there are also alternatives: Otherwise, if the traffic light is green, “You must ride ahead.” applies here. Combined: “If a traffic light is yellow or red you must stop, otherwise you must ride ahead.”.

A selection is made up of two or three parts:
• A condition (“The traffic light is yellow or red.”),
• An action (“You must stop.”),
• and possibly an alternative action (“You must ride ahead.”).

The execution of a selection:
• A condition is an assignment, which is used to decide whether the defined condition is correct. The condition of the example is only true when one of the following assignments applies: “The traffic light is yellow.” or “The traffic light is red.”;
• The assignment of the action or alternative action depends on that result, thus, “You must drive ahead.” or “You must stop.”.