Zoo tutorials: [ SQL | Linux | XML ]
ProgZoo: [ Java | C# | VB | C++ | Perl ]
Log in

A Gentle Introduction to
C# Programming

The if .. else .. if .. statement

 

Control Structures

The if .. else .. if .. statement

Commonly we have a sequence of tests that should be made. We sometimes break the rule regarding indentation to made the code easier to read.

See also: Boxes tutorial
See also: if .. else ...
See also: if .. elsif ...
See also: switch ... case

1. [ C# ] if .. else .. if


Big

Print small, Medium or BIG.

2. [ C# ] if .. if .. else


Big

With two if statements together it may not be obvious how the else statements relate. Notice that in this example there is no code associated with (area<99999) being false.

Note that the line that starts "Australia" does not get finished.