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
Statementsif
Clauses:
else
Clauses:
else
clauseif
Clausesif
Clause:
if
Statementselse
Clause:
if
Statementsif
Statements
if
Statements (cont.)
if
Statements (cont.)
if
Statements (cont.)
boolean
expression must be in
parentheseselse
) are followed by a colonelif
:
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
)