+, -, /, *, %.
Each returns a number, the specific type of which depends on the types of
the operands.
==, !=,
>, <,
>=, <=.
&& (and), || (or), ! (not).
=, which returns nothing
but changes the value of the variable which appears on its left to the value
which appears on its right.
true
or false, that is, booleans.
== operator.
For example, if there is an integer variable called
speed in a particular class,
the following expression asks whether the value of that variable is
currently zero:
!=, >, <, >=, <=.
For example, if getHeading() returns the heading
of a Critter (an integer), the following
expression would ask
whether the heading of the Critter is greater than 3 (that is,
whether the Critter is headed to the left):
if:
true.
It must be enclosed in parentheses.
if together
with else:
if (else) expressions by making
the statements themselves if (else) expressions.
In particular when there are more than two conditions with corresponding
actions, we can do the following:
if
expression, we can replace it with a block statement,
which includes multiple statements which are to be executed in sequence: