Answer
- The else-part consists of three statements, one of which is another
if statement. This is perfectly OK: a then-part or
else-part can contain any number of any kind of statements.
- The nested if statement has no else-part. This is perfectly
OK too. If the condition is false and there is no else-part, the
if statement has no effect. (The then-part, however, is mandatory.)
Return to lesson.
Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah