back to Table of Contents
This section describes the syntax and structure of the Casio JIS Standard BASIC language.
Each BASIC sentence (line) has the following structure:
[line number] Command Operand [: Command Operand [: ...]]
:).Variables are classified into four types based on data type and structure:
| Single Variable | Array Variable | |
|---|---|---|
| Numeric | Numeric variable | Array numeric variable |
| Character (String) | Character variable | Array character variable |
A and a are separate variables.DIM A(10) and A$ can coexist alongside A.A$ to Z$ are limited to 30 characters maximum length.Care must be taken because global variables can cause bugs when multiple programs use the same variable names.
A$ through Z$): maximum 30 characters+ operator is valid for string operations (concatenation).| Operator | Operation | Example |
|---|---|---|
+ |
Addition | A + B |
- |
Subtraction (or negation) | A - B |
* |
Multiplication | A * B |
/ |
Division | A / B |
^ |
Exponentiation | A ^ B |
¥ |
Integer division | A ¥ B |
| MOD | Modulo (remainder) | A MOD B |
Comparison operators return -1 if true and 0 if false.
| Operator | Meaning |
|---|---|
= |
Equal to |
<> or >< |
Not equal to |
< |
Less than |
> |
Greater than |
<= or =< |
Less than or equal to |
>= or => |
Greater than or equal to |
String comparison: Strings are compared character by character using their character codes, from left to right. When one string is a prefix of another, the shorter string is considered smaller.
| Expression | Result |
|---|---|
PRINT "ABC" < "ABD" |
-1 (true) |
PRINT "DEF" < "ABC" |
0 (false) |
PRINT "ABC" > "ABCD" |
0 (false — shorter string is smaller) |
| Operator | Operation | Example |
|---|---|---|
NOT |
Bitwise NOT | NOT A |
AND |
Bitwise AND | A AND B |
OR |
Bitwise OR | A OR B |
XOR |
Bitwise XOR | A XOR B |
See LOGICAL for details.
Operations are evaluated in the following order, from highest to lowest priority:
| Priority | Operation |
|---|---|
| 1 (highest) | Parentheses ( ) |
| 2 | Built-in functions (SIN, COS, etc.) |
| 3 | Exponentiation ^ |
| 4 | Negation - (unary minus) |
| 5 | Multiplication *, Division /, Integer division ¥ |
| 6 | Modulo MOD |
| 7 | Addition +, Subtraction - |
| 8 | Comparison operators (=, <>, <, >, <=, >=) |
| 9 | NOT |
| 10 | AND |
| 11 | OR, XOR |
| 12 (lowest) | String concatenation + (for strings) |
The Casio pocket computers perform internal calculations with 13-digit BCD precision but display only 10 digits. Rounding behavior after the four basic arithmetic operations can be controlled:
When rounding is enabled (MODE10) on the FX-870P/VX-4:
Note: Constant substitution (direct assignment like A = 1.123456789049) is not rounded even when rounding after arithmetic operations is enabled. Rounding only applies to the results of arithmetic operations (e.g., A = A * 1).
Note: The FX-890P/Z-1 uses stricter rounding thresholds (007 and 990 respectively).
When variables are first used, memory is allocated as follows:
| Variable Type | Memory Used |
|---|---|
| Numeric variable | (variable name length + 12) bytes from work area |
| Character variable | (variable name length + 4) bytes from work area, plus (string length + 1) bytes from character area |
Array variables allocated by DIM:
| Array Type | Memory Used |
|---|---|
| Array numeric variable | ((variable name length + 4) + (array size × 8) + (dimensions × 2 + 1)) bytes from work area |
| Array character variable | (variable name length + 4) bytes from work area, plus ((array size) + (dimensions × 2 + 1)) bytes from character area |
The current work area size, variable area size, and free space can be checked with the SYSTEM command and the FRE function.
Multiple BASIC statements can be placed on a single line, separated by colons:
10 A = 1 : B = 2 : PRINT A + B
This is equivalent to:
10 A = 1
20 B = 2
30 PRINT A + B
Most commands work in both modes, but some are restricted to one or the other. Manual commands (like LIST, EDIT, RENUM) can only be used in direct mode. See the Command/Function Table for details.