Comments
// comment here /* comment more than one line */
“Are they not equal?”
!=
“Are they equal?”
==
Logical AND
&&
NOT
!()
OR
||
BOOL type
holds the outcome of a conditional statement, is an alias for an int, and is zero if “false” and 1 if true typically
Header for BOOL
include
IF ELSE
if (conditional)
{
execute this statement
}
else
{
execute this statement instead
}ELSE IF
if (conditional)
{
execute this statement
}
else if (conditional2)
{
execute this statement instead
}
....
else
{
// do this instead
}CONDITIONAL TERNARY OPERATOR
int V = Boolean ? x:y
- if the boolean is TRUE then V takes the value of x
- otherwise if the boolean is FALSE then V takes the value of y.
A more concise way of writing
\_\_\_\_\_\_\_\_
if (Boolean)
{
V = x;
}
else
{
V = y;
}