OPERATORS, IF AND IF/ELSE
Arithmetic Operators: These are they symbols used to calculate values.
It is useful to be aware of the order of operations when working with more than 2 numbers. Here is an example of what I mean:
Relational Operators: These are used when comparing one or more items and will return a Boolean expression.
Logical Operators: used to compare two or more simple conditions at the same time.
Something to go along with the logical operators are what are called, "Truth Tables." Truth tables show all possibilities for logical operators when looking at conditions.
Compound Conditions: This is just where you combine two or more simple conditions with a logical operator.
To say, x = x + 1:
Say you took: y = x++; What's going to happen?
y will = x
and then x will = x + 1.
Say you took y = ++x; What's going to happen?
x will = x + 1
then, y = x.
To say, x = x - 1:
If you took y = x--; What will happen?
y will = x
and then x will = x - 1.
If you had y = --x; What happens?
x will = x - 1;
then y will = x.
Not as confusing as you might think. This will help you when using increment and decrement operators to know the value of your variable through the process of the program.
No Comments for this page.