next up previous
Next: Looping Statement Up: CS101 Lecture 8 Previous: Logical Expressions

Conditional Statements

Branching (IF) (selection or case later)

Most general form and variants

IF condition1 THEN               IF condition1 THEN     If cond1 then
     body1                          statement1              body1
  ELSE IF condition2 THEN           ...                 else
     body2                          statementn             body2
  ...                            End If                 End if

  ELSE IF conditionn THEN
     bodyn
  ELSE
    bodyfinal
End IF
One Special form: IF (cond) statement



G. Sivakumar 2000-08-16