x
and y
are numbers, doesn't know what to report (4 or 5
doesn't
really make sense).
or
were booleans.
One thing you should notice in the above questions is our method of naming variables. To keep things in
order, it is a good idea to choose variable names that give us an idea of their function. In particular,
when we have variables that keep track of boolean values, we give them names that sound like questions.
For example, the name of the variable "inCalifornia" reminds the programmer that the variable will only
contain true
or false
(because "Are we in California?" is a yes/no
question). You can even add a question mark to the names of your variables if you like (e.g. "inCalifornia?").