Control Structures
These are examples of control structures. You may also be interested in:

 Conditional structures
 Exceptions
 Flow-control structures
 Loops

Task

List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions.

Common conditional structures include if-then-else and switch.

Less common are arithmetic if, ternary operator and Hash-based conditionals.

Arithmetic if allows tight control over computed gotos, which optimizers have a hard time to figure out.



begin
    integer a, b, c;
 
    a := 1; b := 2; c := 3;
 
    % algol W has the traditional Algol if-the-else statement                %
    % there is no "elseif" contraction                                       %
    if a = b
    then write( "a = b" )
    else if a = c
         then write( "a = c" )
         else write( "a is ", a );
 
    % if-then-else can also be used in an expression                         %
    write( if a < 4 then "lt 4" else "ge 4" );
 
    % algol W also has a "case" statement, an integer expression is used to  %
    % select the statement to execute. If the expression evaluates to 1,    %
    % the first statement is executed, if 2, the second is executed etc.     %
    % If the expression is less than 1 or greater than the number of         %
    % statements, a run time error occurs                                    %
    case a + b of
    begin write( "a + b is one"   )
        ; write( "a + b is two"   )
        ; write( "a + b is three" )
        ; write( "a + b is four"  )
    end;
 
    % there is also an expression form of the case:                          %
    write( case c - a of ( "one", "two", "three", "four" ) )
 
end.