3QL4
3QL4
Third Quarter
Lesson 4
Faith Over Fear – The Yulee News
Example: year=1995;
This declares a variable called year and assigns the
integer value 1995 to this variable.
Lifetime of a Variable
++ Increment
See example under While statement
(Controls and Loops)
-- Decrement
• All operators seem familiar except perhaps the
modulus, increment and decrement operations.
• The increment operator ++ simply adds one to the
value of your variable while the decrement subtracts
one. These operators are normally used within a loop
or control structure, which will be discussed later.
• Modulus is simply the remainder of a division
operation.
Try this example in your text editor then open in
your browser then show the browser output:
Assignment Operators
• Assignment operators, except for the “=“ operator,
which only assigns value, are used to both assign
and perform math operators. It is some sort of
shorthand for some less simple math operations.
• Specifically, most of these operators first perform
a math operation between two variables and then
assign the result to one of the variables.
Operator Name Example