| | character variables definition ⇒ CHARACTER |
| text = "hello world" | string variable = string constant |
| c100 = Left // Right | string concatenation appends Left to Right |
| text(i: j) = string(3:) | : text byte i to j = string byte 3 to end_string |
| c1 = CHAR( 65 ) | same as c1 = "A" |
| | compares a and b (both numeric, or both character) |
| a < b | less than (same as a.LT.b). 3 < 4 evaluates to 1 |
| a <= b | less than or equal to (same as a.LE.b). "A" <= "a" evaluates to 1 (A precedes a in the ASCII collating sequence) |
| a == b | equal to (same as a.EQ.b). 1-4 == (-3) evaluates to 1 (parenthesize unary subtraction) |
| a /= b | not equal to (same as a.NE.b). 3 * 4 > 5 evaluates to 1 (numeric has higher precedence than relational) |
| a >= b | greater than or equal to (same as a.GE.b). 3 >= 4 - 2 evaluates to 1 |
| a > b | greater than (same as a.GT.b). "a" > "a" // "A" evaluates to 0 (// has higher precedence than relational) |
| | 0 is false, /=0 is true: |
| true = -123.45 | any scalar value not equal to 0 is true |
| maybe = y > 1 | maybe is set to 1 for y > 1, else it is 0 |
| (3 < 4) + 5 | → 6 ( because 3 < 4 → 1) |
| L1 + L2 | → L1+L2 (false if 0) |
| (L1>0) + (L2<0) | , true if not 0 |
| (L1>0) * (L2<0) | , true if not 0 |
| IF( x ) x = 1/x | conditional execution: division only for x not equal 0, ⇒ see also |
| all numeric entities are 8 byte floating point |
| 3.1415 | constant |
| pi = 3.1415 | defines a variable named pi |
| pi = ACOS(-1) | set pi to result of arccosine function |
| (3 + pi) / 2 | parenthesis to force order of evaluation |
| a = -1 | unary subtraction |
| b = 1 + 2 - 3/4 | b is set to 2.25 |
| c = (2^2)**0.5 | ^ and ** are identical operators |
| i = INT( pi ) | == 3 (i is internally still 8-byte floating point) |
| L = LEN("Hello") | == 5 |
| : | (from low:) relational → + and - → * and / → ^ or ** (to high) 2^3 / 4 * 3 + 0.5 > 6 is the same as (((2^3) / 4 * 3) + 0.5) > 6 |
| | ⇒ array definitions |
| vec(15) | element 15 of the 1-dimensional array vec. Index origin is 1. |
| mtx(i,j) | element row i, column j. This is element number (i-1)*columns + j (storage is row by row). |
| vec = (3.14, x, x+1, x^2, SIN(x), ...) | set vec to individual values starting with element 1 |
| mtx = 0 | all elements of mtx = 0 |
| vec = $**2 | set vec = 1 4 9 16 25 ... |
| vec = mod($,11)==1 | set vec = (1 0 0 0 0 0 0 0 0 0 1 0 0 ...) |
| ALLOCATE(vec, 10, 10) | set vec to a 10x10 |
| DLG(Edit = matrix) | opens a spreadsheet-like dialog |
| LINE(x=x_array, y=y_array) | plot one array against another |
| DIFFEQ(..., Y=vector) | simultaneous 1st order differential equations |
| INDEX( vector, 3.14 ) | 1st occurence of 3.14 in vector |
| INTPOL(XV=x_vec, YV=y_array, x=3.27, ...) | cubic interpolation |
| READ(text="3.1 by 5.2 and 4 4 U") vector | set vector = (3.1, 5.2, 4, 4) |
| SOLVE(Matrix=A, Vector=B) | solve linear equations |
| SORT(Vector=A, Sorted=B) | sort has many options |
| WRITE(Name) vec | outputs e.g.: vec(1)=1 vec(2)=3.141592654 vec(3)=2.302 |