|
Conditions and Decisions
An Introduction with Examples in Java |
|
Prof. David Bernstein
|
| Computer Science Department |
| bernstdh@jmu.edu |
switch Statement
if Statement
if Statement (cont.)
{}) if Statements
if Clauses:
else Clauses:
else clauseif Clauses
if Clause:
if Statements
else Clause:
if Statements
if Statements
if Statements (cont.)
if Statements (cont.)
if Statements (cont.)
boolean expression must be in
parentheseselse) are followed by a colon
elif:
elif clause (that requires
a subsequent else clause)switch/match:
match statement
that is similar to the switch statement in Java
(without explicit break statements
and case _ used in place
of default)