Decision Statements

Everything that is bold is required. Everything else is optional or variable.


If statement outline

if ( relational expression ) one_statement; if ( relational expression ) { statement(s); }

If - else statement outline

if ( relational expression ) one_statement; else one_statement; if ( relational expression ) { statement(s); } else { statement(s); }

Switch statement outline

switch( expression that evaluates to integer ) { case int_constant : statement(s); case int_constant : statement(s); case int_constant : statement(s); case int_constant : statement(s); default: statement(s); } NOTE: the default part is optional but if used then default: is the mandatory syntax.