The range command creates lists of equally spaced numbers. It can take one, two or three arguments.
With one argument:
Example.
Input:
Output:
⎡ ⎣ | 0,1,2,3,4 | ⎤ ⎦ |
With two or three arguments:
Examples.
⎡ ⎣ | 4,5,6,7,8,9 | ⎤ ⎦ |
⎡ ⎣ | 2.3,3.3,4.3,5.3,6.3,7.3 | ⎤ ⎦ |
⎡ ⎣ | 4,6,8,10,12 | ⎤ ⎦ |
⎡ ⎣ | 10,9,8,7,6,5 | ⎤ ⎦ |
You can use the range command to create a list of values f(k), where k is an integer satisfying a certain condition. (See Section 12.3.3 for the for loop used below.)
⎡ ⎣ | 0,2,6,12,20,30,42,56,72,90 | ⎤ ⎦ |
⎡ ⎣ | 5,7 | ⎤ ⎦ |
⎡ ⎣ | 12,30,56 | ⎤ ⎦ |