true
, then use an if
statement:
if (Boolean expression) statement
true
, and another when the expression evaluates to false
,
then use an if
else
statement:
if (Boolean expression) if-true statement else if-false statement
if
or
if
else
statement, then use braces to combine those statements
into a single block.
if
else
statements, then use braces to
clarify your grouping intention.
Boolean expression ? if-true expression : if-false expression