if statements,
switch statements,
for loops, and
while loops.
if statement.
if (test) statement executes the
statement only when the test holds.
if (test) statement else
statement selects between the two statements. It executes
the first if the test evaluates to true and the second if it
evalutes to false.
if
statements.
{
statement1;
statement2;
...
statementn;
}
if statements, such a solution is neither readable nor
efficient.
switch statement
(like the case statement in Pascal).
switch (integer-valued-expression) {
case value1:
stuff-to-do;
break;
case value2:
stuff-to-do;
break;
...
default:
stuff-to-do;
break;
}
break, execution will continue into
the next case.
byte, short, int,
long, or char valued expressions.
break has other uses, which you'll see later.
Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.
Source text last modified Tue Oct 7 17:12:14 1997.
This page generated on Wed Nov 5 12:38:45 1997 by SiteWeaver.
Contact our webmaster at rebelsky@math.grin.edu