[prev] 46 [next]

Conditionals (cont)

if (expression) {
   some statements;
}

if (expression) {
   some statements1;
} else {
   some statements2;
}

  • some statements executed if, and only if, the evaluation of expression is non-zero
  • some statements1 executed when the evaluation of expression is non-zero
  • some statements2 executed when the evaluation of expression is zero
  • Statements can be single instructions or blocks enclosed in { }