Chapter 4 Quick Reference Determine whether two values are equivalent Use the == or != Compare the value of two expressions Use the = Declare a Boolean variable Use the bool keyword as t
Trang 1Chapter 4 Quick Reference
Determine whether two values are
equivalent
Use the == or !=
Compare the value of two
expressions
Use the <, <=, >, or >=
Declare a Boolean variable
Use the bool keyword
as the type of the variable
bool inRange;
Create a Boolean expression that is
true only if two other conditions
are true
&& (number <= hi);
Create a Boolean expression that is
true if either of two other
conditions is true
|| (hi < number);
Run a statement if a condition is
if (inRange) process();
Run more than one statement if a
if (seconds == 59) {
seconds = 0;
minutes++;
}
Associate different statements with
different values of a controlling
expression
Use a switch statement
switch (current) {
case '<':
break;
default :
break;
}