Useful Theory and Math - Module 2
3. Arithmetic Operators
We're going to need these in order to do some math on Pascal, and trust me you'll need that alot.
Addition +
Subtraction -
Multiplication *
Division /
You can also prioritize certain parts of an operations like this.
Example:
10 + 3 * 6 =
10 + 18 =
18
If you put that in pascal it would go about completing the operation like that. If you use brackets you can prioritize certain parts of the operation.
Example:
(10+3)*6=
13*6=
78
4. Relational and equality operators
Equality =
Less than <
Greater than >
Less than or equal to <=
greater than of equal to >=
5. Logical Operators
These are operators which perform a boolean operation, they will evaluate to either true or false.
NOT
AND
OR
NOT example:
Consider the variable P
P = True;
Not P = False;
P = False;
Not P = True;
AND example:
Consider variables P and Q
P = True;
Q = True;
P and Q = True;
P = True;
Q = False;
P and Q = False;
P = False;
Q = True;
P and Q = False;
P = False;
Q = False;
P and Q = False;
OR example:
P = True;
Q = True;
P or Q = True;
P = True;
Q = False;
P or Q = True;
P = False;
Q = True;
P or Q = True;
P = False;
Q = False;
P or Q = False;
0 comentários
Posts a comment