This article will cover a variety of the most common variable types.
James has 2 apples. Amy has twice as many. How many does Amy have?
amyApples: jamesApples * 2;
Programme Input =
Candidate Input =
amyApples is CORRECT
- Set n as a positive integer. An integer between 0 up to but not including the number will be randomly generated.
- Set n as a positive integer and a floating point will be generated between 0.0 and n.0.
- Set a number range with lower and upper limits, and the value increase between each number in between. One of these values will be randomly generated.
- Set a number range with lower and upper limits using an integer, and in square brackets list the integers to exclude.
Possible results for myVar = 0, 1, 2, 3, 4
Possible results for myVar = 0.12…, 0.022…, 1.98…, 1.47… etc.
Possible results for myVar = -3, -2, -1, 0, 1, 2, 3
Possible results for myVar = 0.5, 1.0, 1.5, 2.0, 2.5, 3.0
Possible results for myVar = 1, 2, 3, 4, 8, 9, 10
- Define your variable or value and n rounds the value to that many decimal places.
myVar = 1.5237;
roundedVar: decimalplaces(myVar, 2);
Result = 1.52
roundedVar: decimalplaces(1.5237, 3);
Result = 1.53