Inputs come from the console, from a file,
or from elsewhere in a modular program
– then they are known as 'parameters'
OPERATORS
Numbers: addition, subtraction, division, modular
division (division with a remainder), integer
division, multiplication, to-the-power-of, negation
Boolean: AND, OR, NOT, larger, smaller, equal, not
equal Strings/characters: slicing, length, format
INTEGERS AND REALS
Addition total = amount + VAT Subtraction e.g.
age = cur_year – y_birth Division divide = 5 / 2
Modular division myRemainder = 5 MOD 2 (find a
remainder) Integer division intDivision = 5 DVI 2
Multiplication totalCost = cost * 0.2 Exponential
area = 3.1 * radius^2
STRING OPERATIONS
String Features Slicing e.g. LEFT(“monkey”,4) is
“monk” Length e.g. LEN(“monkey”) [=6] Change
case e.g. “monkey””MONKEY””Monkey”
Formatting Features ASCII and Unicode e.g.
ASCII(“c”) [=99] Escape characters e.g. ‘it\’s me’ [it’s
me] White space: CR NewLine, TAB 4 or 5 spaces
BOOLEAN OPERATORS
AND - two conditions must be true for the
statement to be true OR - at least one
condition must be true for the statement to be
true NOT – inverts the result, e.g. NOT(A and B)
will only be false when both A and B are true
WHAT, OPERATORS ARE USED WHERE?
Numbers: addition, subtraction, division, modular division (division with a
remainder), integer division, multiplication, to-the-power-of, negation Boolean: AND,
OR, NOT, larger, smaller, equal, not equal Strings/characters: slicing, length, format