Please enable JavaScript.
Coggle requires JavaScript to display documents.
Variables, Constants and Operators (Arithmetic ((+) adds, (-) minuses, (*)…
Variables, Constants and Operators
Variables
VARIABLE- has the purpose of being able to keep track of changing data. It is a location in memory that holds one or more values. It has a label or name to identify it and its values can be changed as the program runs.
-
Variables can get more complex than this. For example a variable might be a list of values (called an array/list):
e.g. numbers={10,16,1}
Constant
CONSTANT- has the purpose of setting data values that will not change as the program runs. It is also a location in memory that holds a value. It has a label or name to identify it and its value cannot be changed as the program runs.
-
Operators
OPERATORS- carry out operations and compare data. There are several types of operators such as:
- Arithmetic
- Boolean
- Assignment
- Compound Assignment
Arguments--An operator always acts on at least one item. This item is called the 'argument' of the operator.For example the addition operator '+' has two arguments such as
1+2
The arguments are 1 and 2 in this case.
Arithmetic
-
-
-
-
-
DIV- divides it and gives answer without remainder. MOD- divides it but only tells you the remainder
-
Assignment
-
The simplest assignment operator is "=". It copies the value of its right argument into the argument on its left
-
-
-
-
-