# About OPL Keywords

## Contents

- Typing keywords
- How commands are specified
- How functions are specified

## Typing keywords

- Commands, functions and arguments may be typed in any combination of UPPER and lower case.
- To put more than one statement on a line, separate them by a space followed by a colon. For example:

`CLS : PRINT "hello" : GET`

Any commands may be strung together like this, and as many of them as you like, provided the total line length does not exceed 255 characters. The colon is optional before a `REM` statement.

- Where one space is allowed, any number of spaces is allowed, e.g.

`CLS : PRINT "Press Esc"`

- Functions may be used as arguments to other functions or commands e.g. `PRINT LEFT$(A$,3)` and `a = COS(ABS(x))` are OK.

## How commands are specified

Commands are specified as,

        COMMAND argument(s)

where `argument(s)` follow the command after a space and are separated from each other by commas. The arguments may include:

- Floating-point expressions (e.g. `SIN(30)+2`), variables (e.g. `price` or `z`), literal values (e.g. `78.9`), or declared constants (e.g. `KFixed`).
- Integer expressions (e.g. `3*567`), variables (e.g. `price%`, or `price&` if in range), literal values (e.g. `-5676`), or declared constants (e.g. `KFixed%`).
- Long integer expressions (e.g. `3*56799`), variables (e.g. `profit&`), literal values (e.g. `-5676869`), or declared constants (e.g. `KFixed&`).
- String expressions (e.g. `b$+MID$(a$)`), variables (e.g. `price$`), literal values (e.g. `"word"`), or declared constants (e.g. `KFixed$`).
- Logical file names (e.g. `A`, `B`, `Q`).
- Field names (e.g. `B.taxcode%`, `P.item&`).

For example, `AT X%,Y%` might be used like this: `AT 15,2`

## How functions are specified

Functions are specified as,

        variable=FUNCTION(argument(s))

where `variable` may be `f%` or `f&` for a function returning an integer or long integer result, `f` for a function returning a floating-point result, or `f$` for a function returning a string result. The `argument(s)`:

- follow the command immediately
- are enclosed in brackets: `(` `)`
- are separated from each other in the brackets by a comma: `,`
- may include variables, literal values, expressions or declared constants of the appropriate kind - integer, long integer, floating-point or string, as described above.

E.g. `f$=LEFT$(g$,x%)` might be used like this: `PRINT LEFT$(fname$,2)`

If you use the wrong type of number as an argument it will, where possible, be converted. For example, you can use an integer for a floating-point argument, or a long integer for an integer argument. If the conversion is not possible — for example, if you use a floating-point number for an integer argument and its value is outside the range of integers an error will be produced and the program stopped. Some functions, such as `GET`, have no arguments.