A
  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X  Y  Z

ABS()

intrinsic

numeric = ABS( numeric )

Return the absolute value of any simple numeric type. The return type is the same as the argument.

a = +23
b = -23
c = ABS(a) ' c = 23
d = ABS(b) ' d = 23

ALL

See SELECT CASE

AND

binary
bitwise
operator

integers = integers AND integers

Bitwise AND two integer operands to produce an integer result.

a = 0x05F0
b = 0xFFA0
c = a AND b ' c = 0x05A0

ASC()

intrinsic

integer = ASC( string ) 
integer = ASC( string, position ) 

Return one byte from a string. The first argument is the string to extract the byte from. The second argument is the position of the byte to extract, or 1 if no second argument is given.

a$ = "abcde"
b = ASC(a$) ' b = 'a'
c = ASC(a$,4) ' c = 'd'
d = ASC(a$,6) ' d = -1 ( specified byte not within string )

ATTACH

statement

ATTACH arrayNode TO arrayNode

Move an array from source node to destination node. If the destination node is not empty a runtime error occurs. After the array is moved to the destination node, the source node is zeroed.

ATTACH a[] TO b[] ' attach array to array
ATTACH a[] TO b[i,] ' attach array to node
ATTACH a[i,] TO b[] ' attach node to array
ATTACH a[i,] TO b[j,k,] ' attach node to node
ATTACH a$ TO b$[i] ' attach string to node
ATTACH b$[i] TO a$ ' attach node to string

AUTO
AUTOX

statement

AUTO [typename] variables
AUTOX [typename] variables

Declare variables with AUTO and AUTOX scope.

AUTO a, b$, c[]
AUTO SINGLE x, y, z
AUTO MYTYPE first[], middle[], last[]
AUTOX i, j$, k[]
AUTOX DOUBLE p[], q[], r[], s[], t[]
AUTOX TYPERS fast[], accurate[], both[]

BIN$()
BINB$()

intrinsic

string = BIN$( integers ) 
string = BINB$( integers ) 
string = BIN$( integers, digits ) 
string = BINB$( integers, digits ) 

Return the binary string representation of an integer. The return string has as many characters as necessary to represent the integer, or the number specified by the second argument, whichever is larger.

a = 0xF0F5
a$ = BIN$(a) ' a$ = "1111000011110101"
a$ = BINB$(a) ' a$ = "0b1111000011110101"
a$ = BIN$(a,20) ' a$ = "00001111000011110101"
a$ = BINB$(a,20) ' a$ = "0b00001111000011110101"
a$ = BIN$(a,5) ' a$ = "1111000011110101"
a$ = BINB(a,5) ' a$ = "0b1111000011110101"

BITFIELD()

intrinsic

bitspec = BITFIELD( width, offset ) 

Return a bitfield specification appropriate for bitfield extract and bitfield intrinsics. The first argument is the width of the bitfield. The second argument is the offset of the bitfield from the least significant bit. Valid widths are 1 to 31, and valid offsets are 0 to 31.

Works in prolog given two integer constants, and elsewhere in programs with integer values.

$$BYTE0 = BITFIELD(8, 0) ' bits 00-07 : low byte
$$BYTE1 = BITFIELD(8, 8) ' bits 08-15 : next higher
$$BYTE2 = BITFIELD(8, 16) ' bits 16-23 : next higher
$$BYTE3 = BITFIELD(8, 24) ' bits 24-31 : high byte
$$KINDS = BITFIELD(5, 21) ' bits 21-25 : 5 wide bitfield at bit 21
spacing = BITFIELD(3, 29) ' bits 29-31 : 3 wide bitfield at bit 29

CASE

See SELECT CASE

CFUNCTION

See FUNCTION

CHR$()

intrinsic

string = CHR$( integer ) 
string = CHR$( integer, count ) 

Return a string of 1 or more copies of a character. The first argument is the value of the character. The second argument is the number of copies of the character, which defaults to 1 when not given.

a$ = CHR$(32) ' a$ = " " ( 1 space character )
a$ = CHR$(32, 8) ' a$ = " " ( 8 space characters )
a$ = CHR$('x', 8) ' a$ = "xxxxxxxx" ( 8 'x' characters )

CJUST$()
LJUST$()
RJUST$()

intrinsic

string = CJUST$( string, length ) 
string = LJUST$( string, length ) 
string = RJUST$( string, length ) 

Return a string center-justified, left-justified, or right-justified in a field of space characters. The first argument is the string to justify. The second argument is the field width. The return string is always the specified width. If a string cannot be exactly centered, the extra space follows the string. If the string is longer than the field, the string is left justified and clipped at the end of the field.

a$ = "cat"
b$ = "catamaran"
a$ = CJUST$(a$,7) ' a$ = " cat " ( exact centering )
a$ = CJUST$(a$,8) ' a$ = " cat " ( excess space on right )
a$ = CJUST$("xxx",9) ' a$ = " xxx " ( exact centering )
a$ = CJUST$(b$,3) ' a$ = "cat" ( no fit, left justify )
a$ = LJUST$(a$,6) ' a$ = "cat " ( left justify cat in 6 )
a$ = LJUST$(b$,7) ' a$ = "catamar" ( string longer than 7 )
a$ = LJUST$("xxx",8) ' a$ = "xxx " ( left justify xxx in 8 )
a$ = LJUST$(b$,3) ' a$ = "cat" ( string longer than 3 )
a$ = RJUST$(a$,6) ' a$ = " cat" ( right justify in 6 )
a$ = RJUST$(a$,7) ' a$ = "tamaran" ( clip leading to fit )
a$ = RJUST$("xxx",8) ' a$ = " xxx" ( right justify in 8 )
a$ = RJUST$(b$,3) ' a$ = "ran" ( clip leading to fit )

CLOSE()

intrinsic

integer = CLOSE( fileNumber )

Close an open file and return 0 to indicate success. The argument is the filenumber assigned to the file when it was opened. If the argument is not the filenumber of an open file, -1 is returned.

err = CLOSE (ifile) ' test for close error
CLOSE (ofile) ' ... or don't bother

CLR()
SET()

intrinsic

integer = CLR( integer, bitspec ) 
integer = CLR( integer, width, offset ) 
integer = CLR( integer, bitspec ) 
integer = CLR( integer, width, offset ) 
integer = SET( integer, bitspec ) 
integer = SET( integer, width, offset ) 
integer = SET( integer, bitspec ) 
integer = SET( integer, width, offset ) 

Clear or set a field of bits. The first argument is the integer value in which the bits are cleared or set. In the two argument version, the second argument is a bitspec that contains the width and offset of the bitfield to clear or set. In the three argument version the second and third arguments are the width and offset of the bitfield to clear or set.

$$TYPE = BITFIELD(5,16) ' in PROLOG
$KIND = BITFIELD(5,24) ' in a function
kind = BITFIELD(5,24) ' variable as bitspec
i = 0xFFFFFFFF ' i = 0xFFFFFFFF
j = 0x00000000 ' j = 0x00000000
a = CLR(i, $$TYPE) ' a = 0xFFE0FFFF
a = CLR(i, $KIND) ' a = 0xE0FFFFFF
a = CLR(i, kind) ' a = 0xE0FFFFFF
a = CLR(i, 8, 4) ' a = 0xFFFFF00F
a = SET(j, $$TYPE) ' a = 0x001F0000
a = SET(j, $KIND) ' a = 0x1F000000
a = SET(j, kind) ' a = 0x1F000000
a = SET(j, 8, 4) ' a = 0x00000FF0

CSIZE()

intrinsic 

integer = CSIZE( string ) 

Return the number of bytes in a string before the first zero byte.

a$ = ""
b$ = "abcdefg"
c$ = "abc\0defg"
a = CSIZE(a$) ' a = 0
a = CSIZE(b$) ' a = 7
a = CSIZE(c$) ' a = 3

CSIZE$()

intrinsic

string = CSIZE$( string ) 

Return a copy of a zero terminated string. The end of the string is the byte before the first zero byte.

a$ = ""
b$ = "abcdefg"
c$ = "abc\0defg"
s$ = CSIZE$(a$) ' s$ = ""
s$ = CSIZE$(b$) ' s$ = "abcdefg"
s$ = CSIZE$(c$) ' s$ = "abc"

CSTRING$()

intrinsic

string = CSTRING$( address ) 

Return a copy of a string at a memory address. The end of the string is the byte before the first zero byte. This intrinsic converts C style strings into native strings. The string at the specified address is not altered or freed.

cstr = cfunc()
a$ = CSTRING$(cstr)

DCOMPLEX

statement

[scope] DCOMPLEX variables

Declare double precision complex variables.
Also see Declarations after the alphabetical listing.

DCOMPLEX ii, jj, kk
DCOMPLEX x[], y[], z[]
SHARED DCOMPLEX a, b, c, a[], b[], c[]

DECLARE FUNCTION
EXTERNAL FUNCTION
INTERNAL FUNCTION

statement 

DECLARE FUNCTION [type] Func ( [parameters] ) 
EXTERNAL FUNCTION [type] Func ( [parameters] ) 
INTERNAL FUNCTION [type] Func ( [parameters] ) 

Declare a function:

DECLARE - function in current program, visible to all programs.
INTERNAL - function in current program, invisible to other programs. 
EXTERNAL - function not in current program, visible to all programs.

The optional return type is any built-in or user-defined data type.

parameters is an optional comma-separated list of up to 16 built-in or user-defined type names or symbols from which the kind and type of each function argument can be determined.

DECLARE FUNCTION Twist ()
INTERNAL FUNCTION DOUBLE DarkSine ( a#, b#, c#[] )
EXTERNAL FUNCTION DCOMPLEX DoodleDuxis ( DCOMPLEX dd, DCOMPLEX ee )

DHIGH()
DLOW()

intrinsic

integer = DHIGH( double ) 
integer = DLOW( double ) 

Return the high or low 32-bits of a double precision floating point number. The high 32-bits of a double precision floating point number contains the sign bit, exponent, and high part of the mantissa, while the low 32-bits contains the low part of the mantissa.

a# = 0d40010802DEADCODE ' a# = double variable
b# = 0d4000800080000000 ' b# = double variable
i = DHIGH(a#) ' i = 0x40010802
j = DHIGH(b#) ' j = 0x40008000
i = DLOW(a#) ' i = 0xDEADCODE
j = DLOW(b#) ' j = 0x80000000

DIM
REDIM

statement

DIM array [ subscripts ] 
REDIM array [ subscripts ] 

Dimension or redimension an array. 0 to 8 comma-separated integer subscripts give the upper bounds for 0 to 8 dimensions. The lower bound of all arrays is 0.

When an array is dimensioned, the existing contents are first freed, then memory space for the array is allocated and filled with zeros.
When an array is redimensioned, the existing contents not in the new size are lost, the existing contents in both the old and new size are unchanged, and contents in the new size only are zeroed.

DIM a[] ' a[] becomes an empty array
DIM a#[upper] ' dimension a#[], upper bound = u
DIM points[100000] ' dimension points[], upper bound = 100000
DIM a$[tops] ' dimension string array, upper bound = tops
DIM a[i,j,k] ' dimension a three dimensional array
DIM a[i,j,] ' dimension a two dimensional array of nodes

DLOW()

See DHIGH()

DMAKE()

intrinsic

double = DMAKE( high32, low32 ) 

Return a 64-bit double precision floating point number assembled from two 32-bit integer parts.

hi = 0x40008000 ' high 32-bits of desired DOUBLE
lo = 0x80000000 ' low 32-bits of desired DOUBLE
i# = DMAKE(hi, lo) ' i# = 0d4000800080000000
i# = DMAKE(si OR uman, lman) ' i# = assemble sign, hi/lo mantissa

DO
DO WHILE
DO UNTIL
DO DO
DO LOOP
EXIT DO
LOOP
LOOP WHILE
LOOP UNTIL

statement

DO 
DO WHILE numString
DO UNTIL numString
DO DO [level]
DO LOOP [level]
EXIT DO [level]
LOOP 
LOOP WHILE numString
LOOP UNTIL numString

DO...LOOP blocks.

DO begins a loop, and execution continues on the next line.

DO WHILE continues execution on the next line if the numeric or string value is TRUE , otherwise execution continues after the matching LOOP statement.

DO UNTIL continues execution on the next line if the numeric or string value is FALSE , otherwise execution continues after the matching LOOP statement.

DO DO jumps directly to the DO statement at the beginning of a loop block from anywhere inside the block.

DO LOOP jumps directly to the LOOP statement at the end of a loop block from anywhere inside the block.

EXIT DO jumps directly past the LOOP statement at the end of the loop block, from anywhere inside the block.

LOOP jumps to the matching DO statement.

LOOP WHILE jumps to the matching DO statement if the numeric or string expression is TRUE .

LOOP UNTIL jumps to the matching DO if the numeric or string expression is FALSE .

hash = 0
IF a$ THEN
o = 0 ' offset = 0
u = UBOUND(a$) ' u = upper offset in a$
DO WHILE (o <= u) ' do hash loop while offset <= upper offset
hash = hash + a${o} ' add next byte to hash
INC o ' offset to next byte in a$
LOOP
END IF

DOUBLE

See Declarations after the alphabetical listing. 

DOUBLE()

See Type Conversions after the alphabetical listing. 

DOUBLEAT()

See Direct Memory Access after the alphabetical listing. 

ELSE

See IF

END FUNCTION

statement

END FUNCTION [expression]

End a function and return a value. If no return expression is given, a zero or empty string is returned.

END IF

See IF

END SELECT

See SELECT CASE

END SUB

See SUB

END TYPE

See TYPE

EOF()

intrinsic

integer = EOF( fileNumber ) 

Return TRUE if filepointer points beyond the end of a file.

a = EOF(ifile)
DO UNTIL EOF(ifile)

ERROR()

intrinsic

error = ERROR( newError ) 

Return ##ERROR error number and assign a new error number unless newError = -1 .

IF ERROR(-1) THEN ' test ##ERROR without clearing it
error = ERROR(0) ' get current ##ERROR, then clear it
error = ERROR(-1) ' get current ##ERROR without changing it
error = ERROR(new) ' get current ##ERROR and assign a new value

ERROR$()

intrinsic

error$ = ERROR$( error ) 

Convert an error number into an error string.

error = ERROR(0) ' get error number
error$ = ERROR$(error) ' error$ = error string

EXIT DO

statement

EXIT DO [level]

Exit a DO loop.

Jump past the n th LOOP statement, where n=1 or level.

DO
a$ = INLINE$ ("Enter another choice ===>> ")
IFZ a$ THEN EXIT DO
RegisterEntry (a$)
LOOP

EXIT FOR

statement

EXIT FOR [level]

Exit a FOR loop.

Jump past the n th NEXT statement, where n=1 or level.

FOR i = 0 TO 1000
a$ = INLINE$ ("Enter another choice ===>> ")
IFZ a$ THEN EXIT FOR
RegisterEntry (i, a$)
NEXT i

EXIT FUNCTION

See RETURN

EXIT IF

statement

EXIT IF [level]

Exit an IF block.

Jump past the n th END IF statement, where n=1 or level.

IF enabled THEN
IF (value < max) THEN
IF verify[entry] THEN
a = verify[entry]
IF (a < 0) THEN EXIT IF 4
verify[entry] = a+1
END IF
END IF
END IF

EXIT SELECT

statement

EXIT SELECT [level] 

Exit a SELECT CASE block.

Jump past the n th END SELECT statement, where n=1 or level.

SELECT CASE a
CASE 1: GOSUB FireAway
CASE 2: GOSUB BreakOut
CASE 3: k = Prefix(n)
IFZ k THEN EXIT SELECT
GOSUB PassOff
END SELECT

EXIT SUB

See SUB

EXPORT

EXPORT 

Begin exporting type and shared constant definitions and function declarations from a program being compiled as a function library. All source lines between EXPORT and END EXPORT statements are put in " filename .dec" .

EXPORT
TYPE LINK
XLONG .backward
XLONG .forward
END TYPE
'
DECLARE FUNCTION DOUBLE Square (x#)
DECLARE FUNCTION DOUBLE Cube (x#)
END EXPORT
'
EXPORT
$$Off = 0
$$On = -1
END EXPORT

EXTERNAL

See Declarations after the alphabetical listing. 
EXTERNAL FUNCTION See DECLARE FUNCTION

EXTS()
EXTU()

intrinsic

integer = EXTS( integer, bitspec ) 
integer = EXTS( integer, width, offset ) 
integer = EXTU( integer, bitspec ) 
integer = EXTU( integer, width, offset ) 

Extract a signed or unsigned field of bits. The first argument is the integer value from which the bits are extracted. In the two argument version, the second argument is a bitspec that contains the width and offset of the bitfield to extract. In the three argument version the second and third arguments are the width and offset of the bitfield to extract.

The extracted bitfield is returned in the low bits of the result, either sign-extended or zero-extended to fill the 32-bit integer result.

$$TYPE = BITFIELD(4,16) ' in PROLOG
$KIND = BITFIELD(4,20) ' in a function
spaz = BITFIELD(8,24) ' variable as bitspec
i = 0x89ABCDEF ' i = 0x89ABCDEF
a = SET(i, $$TYPE) ' a = 0x0000000B
a = SET(i, $KIND) ' a = 0x0000000A
a = SET(i, spaz) ' a = 0x00000089
a = SET(i, 8, 4) ' a = 0x000000DE

FALSE

See SELECT CASE

FIX()

See INT()

FOR
DO FOR
DO NEXT
EXIT FOR
NEXT

statement

FOR var = numeric TO numeric [ STEP numeric]
DO FOR [level] 
DO NEXT [level] 
EXIT FOR [level] 
NEXT [var]

Begin and end a FOR ... NEXT loop.

DO FOR jumps directly to the FOR statement.

DO NEXT jumps directly to the NEXT statement.

EXIT FOR jumps directly past the NEXT statement.

FOR i = 0 TO last
i$ = item$[i]
IFZ i$ THEN DO NEXT
IF i$ = "outta here" THEN EXIT FOR
IF (i$ = "trash") THEN i = i + 3 : DO FOR
Register (i$)
NEXT i

FORMAT$()

intrinsic

string = FORMAT$( format$, argument ) 

Return a string formatted per a format spec string and argument.

FORMAT$() creates and returns a string representation of up a numeric or string argument, formatted according to a format$ string.

The following are valid format fields for string arguments:

& Print string exactly, no upper or lower length limit
< Left justify string in <<<<< field (1 to 255 "<" characters)
> Right justify string in >>>>> field (1 to 255 ">" characters)
| Center justify string in ||||| field (1 to 255 "|" characters)

The following are valid character sequences for numeric arguments:

### digit positions ###### 54321
. decimal point ###.## 23.00
, commas every 3 places ##,###.## 27,654,321.80
^^^^ short exponent #.###^^^^ 3.711e+22
^^^^^ long exponent #.##^^^^^ 3.71d+022
(###) negative #s in parens (#####) (54321)
$ leading $ symbol $###.## $3.76
* * in leading zeros *####.## ****3.76
+ print leading +/- sign +####.## +234.56
+ print trailing +/- sign ####.##+ 234.56+
- print trailing - if negative ####.##- 234.56-
_ print next character exactly a_$_#_._-_+ a$#.-+

x = 23
y$$ = 23456
z# = 11111.222
j$ = "scam"
fa$ = " ###"
fb$ = "###,###"
fc$ = "###.####^^^^^"
fd$ = "||||||"
PRINT FORMAT$ (fa$,x) ' " 23"
PRINT FORMAT$ (fb$,y$$) ' " 23,456"
PRINT FORMAT$ (fc$,z#) ' " 111.1122d+002
PRINT FORMAT$ (fd$,j$) ' " scam "
a$ = FORMAT$ (fa$,x) + FORMAT$ (fb$,y$$) ' a$ = " 23 23,456"

FUNCADDR

statement

[scope] FUNCADDR [type] variable ( [parameters] ) 
[scope] FUNCADDR [type] array []( [parameters] ) 

Declare a FUNCADDR variable or array.

STATIC FUNCADDR a ( STRING, XLONG, XLONG, XLONG )
SHARED FUNCADDR DOUBLE Manglex[] ( DOUBLE, DOUBLE )

FUNCADDR()

See Type Conversion after the alphabetical listing. 

FUNCADDRESS()

intrinsic

funcaddr = FUNCADDRESS( FuncName ()) 

Return the address of a function. Same as &Func() . 

process[GetColor] = FUNCADDRESS (XuiGetColor())
process[SetColor] = FUNCADDRESS (XuiSetColor())

FUNCTION
SFUNCTION
CFUNCTION

statement

FUNCTION [type] FuncName ( arguments ) [defaultType]
SFUNCTION [type] FuncName ( arguments ) [defaultType]
CFUNCTION [type] FuncName ( arguments ) [defaultType]

Begin the body of a function. The return type defaults to XLONG unless specified otherwise. The arguments are a comma-separated list of variables receiving input values from calling functions. The type of variables in the function not declared otherwise defaults to XLONG unless a defaultType is specified.

FUNCTION denotes a normal function.

SFUNCTION denotes operating system functions with standard operating system function protocol, or native functions to be called by the operating system expecting standard operating system protocol (STDCALL) .

CFUNCTION denotes C functions or native functions to be called by functions expecting standard C function protocol (CDECL) .

FUNCTION Blivit ( a, b, c$, d[] )
FUNCTION Bondar ( i#, j#, k#, l#, m# )
SFUNCTION DOUBLE DoLittle ( DOUBLE lo, DOUBLE hi ) DOUBLE
CFUNCTION DOUBLE ArcCosh ( DOUBLE arg )

GHIGH()
GLOW()

intrinsic

integer = GHIGH( giant ) 

Return the high or low 32-bits of a 64-bit signed integer.

a$$ = 0x40010802DEADCODE ' a$$ = giant variable
b$$ = 0x4000800080000000 ' b$$ = giant variable
i = GHIGH(a$$) ' i = 0x40010802
j = GHIGH(b$$) ' j = 0x40008000
i = GLOW(a$$) ' i = 0xDEADCODE
j = GLOW(b$$) ' j = 0x80000000

GIANT

See Declarations after the alphabetical listing. 

GIANT()

See Type Conversions after the alphabetical listing. 

GIANTAT()

See Direct Memory Access after the alphabetical listing. 

GLOW()

See GHIGH()

GMAKE()

intrinsic

giant = GMAKE( high32, low32 ) 

Return a 64-bit signed integer assembled from two 32-bit integers.

hi = 0x40008000 ' hi 32-bits of desired GIANT
lo = 0x80000000 ' lo 32-bits of desired GIANT
i$$ = GMAKE(hi, lo) ' i$$ = 0x4000800080000000
i$$ = GMAKE(upper, lower) ' i$$ = make GIANT from two XLONGs

GOADDR

See Declarations after the alphabetical listing. 

GOADDR()

See Type Conversions after the alphabetical listing. 

GOADDRAT()

See Direct Memory Access after the alphabetical listing. 

GOADDRESS()

intrinsic

goaddr = GOADDRESS( label ) 

Return the address of a GOTO label.

g = GOADDRESS (label)
h[i] = GOADDRESS (another)

GOSUB

statement

GOSUB SubName
GOSUB @ subVar
GOSUB @ subArray [ indices ] 

Call a subroutine directly, through a variable, or through an array.

GOSUB subroutine
GOSUB @subVar
GOSUB @subArray[i]

GOTO

statement

GOTO label

Jump to a label directly, through a variable, or through an array.

GOTO label
GOTO @goVar
GOTO @goArray[i]

HEX$()
HEXX$()

intrinsic

string = HEX$( integers ) 
string = HEXX$( integers ) 
string = HEX$( integers, digits ) 
string = HEXX$( integers, digits ) 

Return the hexadecimal string representation of an integer. The return string has as many characters as necessary to represent the integer in hexadecimal, or the number specified by the second argument, whichever is larger.

a = 0xDEADC0DE
a$ = HEX$(a) ' a$ = "DEADC0DE"
a$ = HEXX$(a) ' a$ = "0xDEADC0DE"
a$ = HEX$(a,2) ' a$ = "DEADC0DE"
a$ = HEXX$(a,2) ' a$ = "0xDEADC0DE"
a$ = HEX$(a,12) ' a$ = "0000DEADC0DE"
a$ = HEXX$(a,12) ' a$ = "0x0000DEADC0DE"

HIGH0()
HIGH1()

intrinsic

integer = HIGH0( integer ) 
integer = HIGH1( integer ) 

Return the bit number of the most significant 0 or 1 bit.

a = 0x00C03333
b = 0xFFFE0000
c = HIGH0(a) ' c = 31
d = HIGH0(b) ' d = 16
e = HIGH1(a) ' e = 23
f = HIGH1(b) ' f = 31

IF
IFZ
IFT
IFF
ELSE
END IF

statement

IF expression THEN statements
IF expression THEN statements ELSE statements
IF expression THEN 
statements
END IF 
IF expression THEN 
statements
ELSE 
statements
END IF 

Execute statements conditionally.

IF a THEN PRINT "a is non-zero"
IFZ a THEN PRINT "a is zero"
IF a$ THEN PRINT "a$ has contents"
IFZ a$ THEN PRINT "a$ is empty"
IF a[] THEN PRINT "a[] has contents"
IFZ a[] THEN PRINT "a[] is empty"
IF (humidity > 80) THEN PRINT "Close The Roof"
IF a THEN
IFZ b THEN
PRINT "a is true, b is not"
ELSE
PRINT "a is true, b is true"
END IF
END IF

IMPORT

IMPORT "libname"

Import function library libname to make its exported types, constants and functions visible to this program. " libname .dec" is read and compiled, and if it exists, " libname .dll" is loaded, linked to the program, and its entry function is called to initialize the library.

IMPORT "xma"
IMPORT "xst"

INC
DEC

statement

INC variable
DEC variable

Add one to a variable or subtract one from a variable.

INC a
INC a[i]
INC x#
INC parent.kids
INC parent[grid].kids
DEC a
DEC a[i]
DEC x#
DEC parent.kids
DEC parent[grid].kids

INCHR()
INCHRI()
RINCHR()
RINCHRI()

intrinsic

integer = INCHR( searchMe$, searchFor$ ) 
integer = INCHR( searchMe$, searchFor$, start ) 
integer = INCHRI( searchMe$, searchFor$ ) 
integer = INCHRI( searchMe$, searchFor$, start ) 
integer = RINCHR( searchMe$, searchFor$ ) 
integer = RINCHR( searchMe$, searchFor$, start ) 
integer = RINCHRI( searchMe$, searchFor$ ) 
integer = RINCHRI( searchMe$, searchFor$, start ) 

Search a string for any of the characters in another string. Return the position of the first match.

INCHR() = forward search, case sensitive
INCHRI() = forward search, case insensitive
RINCHR() = reverse search, case sensitive
RINCHRI() = reverse search, case insensitive

a$ = "Help me please!"
b$ = "ABCDEFG"
c$ = "mromjtp"
a = INCHR(a$,b$) ' a = 0 "e" != "E"
a = INCHR(a$,c$) ' a = 4 "p"
a = INCHR(a$,c$,10) ' a = 0 past matches
a = INCHRI(a$,b$) ' a = 2 "e" = "E"
a = INCHRI(a$,c$) ' a = 4 "p"
a = INCHRI(a$,c$,5) ' a = 6 "m"
a = RINCHR(a$,b$) ' a = 0 "e" != "e"
a = RINCHR(a$,c$) ' a = 9 "p"
a = RINCHR(a$,c$,7) ' a = 6 "m"
a = RINCHRI(a$,b$) ' a = 14 "e" = "E"
a = RINCHRI(a$,c$) ' a = 9 "p"
a = RINCHRI(a$,c$,3) ' a = 0 before matches

INFILE$()

intrinsic

string = INFILE$( fileNumber ) 

Return the next line from an open file.

FUNCTION FindStringInFile (test$, fileName$)
line = 0
ERROR (0)
found = $$FALSE
ifile = OPEN (fileName$, $$RD)
IF ERROR (-1) THEN RETURN (-1)
DO UNTIL EOF(ifile)
line$ = INFILE$ (ifile)
check = INSTR (line$, test$)
IF check THEN
found = $$TRUE
PRINT "Found ===>> "; line$
EXIT DO
END IF
INC line
LOOP
CLOSE (ifile)
END FUNCTION

INLINE$()

intrinsic

string = INLINE$( prompt$ ) 

Return a line from the standard input device (the keyboard).

a$ = INLINE$ ("Enter your name here ===>> ")
IF (a$ = "Bill Gates") THEN PRINT "Yeah, tell me another one."

INSTR()
INSTRI()
RINSTR()
RINSTRI()
intrinsic

integer = INSTR( searchMe$, searchFor$ ) 
integer = INSTR( searchMe$, searchFor$, start ) 
integer = INSTRI( searchMe$, searchFor$ ) 
integer = INSTRI( searchMe$, searchFor$, start ) 
integer = RINSTR( searchMe$, searchFor$ ) 
integer = RINSTR( searchMe$, searchFor$, start ) 
integer = RINSTRI( searchMe$, searchFor$ ) 
integer = RINSTRI( searchMe$, searchFor$, start ) 

Search a string for another string. Return the position of the match.

INSTR() = forward search, case sensitive
INSTRI() = forward search, case insensitive
RINSTR() = reverse search, case sensitive
RINSTRI() = reverse search, case insensitive

a$ = "HEALTHY, wealthy, and wise!"
b$ = "He"
c$ = "alt"
a = INSTR(a$,b$) ' a = 0 no match
a = INSTR(a$,c$) ' a = 12 "alt"
a = INSTR(a$,c$,13) ' a = 0 past match
a = INSTRI(a$,b$) ' a = 1 "HE" = "He"
a = INSTRI(a$,c$) ' a = 4 "ALT" = "alt"
a = INSTRI(a$,c$,5) ' a = 12 "alt" = "alt"
a = RINSTR(a$,b$) ' a = 0 no match
a = RINSTR(a$,c$) ' a = 12 "alt" = "alt"
a = RINSTR(a$,c$,7) ' a = 0 before match
a = RINSTRI(a$,b$) ' a = 1 "HE" = "He"
a = RINSTRI(a$,c$) ' a = 12 "alt" = "alt"
a = RINSTRI(a$,c$,4) ' a = 3 "ALT" = "alt"

INT()
FIX()

intrinsic

float = INT( float ) 
float = FIX( float ) 

Return argument rounded toward nearest integer or toward zero.

b# = 2.552
c# = -2.552
w# = INT(b#) ' w# = 3.000#
x# = INT(c#) ' x# = -3.000#
y# = FIX(b#) ' y# = 2.000#
z# = FIX(c#) ' z# = -2.000#

INTERNAL FUNCTION  See DECLARE FUNCTION

LCASE$()
UCASE$()

intrinsic

string = LCASE$( string ) 
string = UCASE$( string ) 

Convert all characters in a string to lower case or upper case.

a$ = LCASE$ ("THE big LIE") ' a$ = "the big lie"
a$ = LCASE$ ("BIGGER LIES") ' a$ = "bigger lies"
a$ = UCASE$ ("THE big LIE") ' a$ = "THE BIG LIE"
a$ = UCASE$ ("bigger lies") ' a$ = "BIGGER LIES"

LCLIP$()
RCLIP$()

intrinsic

string = LCLIP$( string ) 
string = LCLIP$( string, count ) 
string = RCLIP$( string ) 
string = RCLIP$( string, count ) 

Clip characters off the left or right end of a string.

a$ = LCLIP$ ("This old man", 5) ' a$ = "old man"
a$ = LCLIP$ ("This old man", 15) ' a$ = ""
a$ = RCLIP$ ("This old man", 5) ' a$ = "This ol"
a$ = RCLIP$ ("This old man", 15) ' a$ = ""

LEFT$()
RIGHT$()

intrinsic

string = LEFT$( string ) 
string = LEFT$( string, length ) 
string = RIGHT$( string ) 
string = RIGHT$( string, length )

Copy the first or last characters from a string. The first argument is the string to copy characters from. The second argument is the desired length of the result string, or 1 if no second argument is given. If the string has fewer characters than the desired length, the result string is a copy of the argument string.

x$ = "This old man"
a$ = LEFT$(x$) ' a$ = "T"
a$ = LEFT$(x$, 5) ' a$ = "This "
a$ = LEFT$(x$, 15) ' a$ = "This old man"
a$ = RIGHT$(x$) ' a$ = "n"
a$ = RIGHT$(x$, 5) ' a$ = "d man"
a$ = RIGHT$(x$, 15) ' a$ = "This old man"

LEN()

intrinsic

integer = LEN( string ) 

Return the number of characters in a string.

x$ = ""
y$ = "four"
a = LEN(x$) ' a = 0
a = LEN(y$) ' a = 4

LIBRARY()

integer = LIBRARY( integer ) 

Return $$TRUE if program is compiled as library.

FUNCTION Entry ()
Xui ()
InitGui ()
InitProgram ()
IF LIBRARY(0) THEN RETURN ' main program processes messages
'
DO
XgrProcessMessages (1)
LOOP UNTIL #terminateProgram
END FUNCTION

LJUST$()

See CJUST$()

LOF()

intrinsic

integer = LOF( fileNumber ) 

Return the length of a disk file. The argument is the filenumber.

FUNCTION GimmeFile (filename$)
ifile = OPEN (filename$, $$RD) ' open filename$ for read only
length = LOF (ifile) ' length = # of bytes in filename$
a$ = NULL$ (length) ' make a string that long
READ [ifile], a$ ' and read the file into it
CLOSE (ifile) ' then close the file
RETURN (a$) ' and return the string
END FUNCTION

LOOP

See DO

LTRIM$()

See TRIM$()

MAKE()

intrinsic

integer = MAKE( integer, bitspec ) 
integer = MAKE( integer, width, offset ) 

Shift a field of bits up from the least significant bits. The first argument contains the source bitfield in its least significant bits. In the two argument version, the second argument is a bitspec that contains the width and offset of the bitfield to create. In the three argument version the second and third arguments are the width and offset of the bitfield to create. The bitfield of the specified width is shifted left from the least significant bits by offset bits. All bits outside the bitfield are cleared.

i = 0xAAAAAAAA ' i = 0b10101010101010101010101010101010
j = BITFIELD(5,7) ' j = bitspec for 5-bit wide field at bit 7-11
a = MAKE(i,j) ' a = 0b00000000000000000000010100000000
' *****

MAX()
MIN()

intrinsic

numeric = MAX( numeric, numeric ) 
numeric = MIN( numeric, numeric ) 

Return the maximum or minimum of two values. Maximum means closest to positive infinity and negative means closest to negative infinity. Both values must be the same data type, and the result is the same type as the arguments.

a = 23
b = 123
c = -47
a# = 23
b# = 123.45
c# = .0001
d# = -4d+22
m = MAX(a,b) ' m = 123
m = MAX(a,c) ' m = 23
m# = MAX(a#,b#) ' m# = 123#
m# = MAX(a#,c#) ' m# = 23#
m# = MAX(a#,d#) ' m# = 23#
m = MIN(a,b) ' m = 23
m = MIN(a,c) ' m = -47
m# = MIN(a#,b#) ' m# = 23#
m# = MIN(a#,c#) ' m# = .0001
m# = MIN(a#,d#) ' m# = -4d+22

MID$()

intrinsic

string = MID$( string, start ) 
string = MID$( string, start, length ) 

Copy part of a string. The first argument is the string to copy from. The second argument is the position of the first character to copy. The third argument is the number of characters to copy. If no third argument is given, the rest of the characters in the string are copied.

x$ = "This old man"
a$ = MID$(a$, 5) ' a$ = " old man"
a$ = MID$(a$, 5, 6) ' a$ = " old m"
a$ = MID$(a$, 7, 4) ' a$ = "ld m"
a$ = MID$(a$, 7, 9) ' a$ = "ld man"

MIN()

See MAX() 

MOD

binary
arithmetic
operator

integers = numeric MOD numeric

Return the integer modulus, which is the remainder from a division. Floating point operands are converted to XLONG before the modulus operation is performed.

a = 23 : b = 5 : c = 9 : d = 2
x = a MOD b ' x = 3 (23/5 = 4 + remainder 3)
x = b MOD a ' x = 5 (5/23 = 0 + remainder 5)

NEXT

See FOR

NOT

unary
bitwise
operator

integer = NOT integer

Return an integer with all bits inverted.

a = 0xAAAAFF00
a = NOT a ' a = 0x555500FF

NULL$()

intrinsic

string = NULL$( length ) 

Create a string of null characters. The argument is the number of null characters in the result string. The string returned has the specified number of null characters, plus the additional null character that serves as a terminator. The null terminator is not part of the string and must not be changed.

FUNCTION GimmeFile (filename$)
ifile = OPEN (filename$, $$RD) ' open filename$ for read only
length = LOF (ifile) ' length = # of bytes in filename$
a$ = NULL$ (length) ' make a string that long
READ [ifile], a$ ' and read the file into it
CLOSE (ifile) ' then close the file
RETURN (a$) ' and return the string
END FUNCTION

OCT$()
OCTO$()

intrinsic

string = OCT$( integers ) 
string = OCTO$( integers ) 
string = OCT( integers, digits ) 
string = OCTO$( integers, digits ) 

Return the octal string representation of an integer. The return string has as many characters as necessary to represent the integer in octal, or the number specified by the second argument, whichever is larger.

a = 0o00007643210
a$ = OCT$(a) ' a$ = "76543210"
a$ = OCTO$(a) ' a$ = "0o76543210"
a$ = OCT$(a,2) ' a$ = "76543210"
a$ = OCTO$(a,2) ' a$ = "0x76543210"
a$ = OCT$(a,12) ' a$ = "000076543210"
a$ = OCTO$(a,12) ' a$ = "0x000076543210"

OPEN()

intrinsic

integer = OPEN( fileName$, mode ) 

Open a disk file. The first argument is the filename. The second argument contains an integer value that determines how the file will be open as follows (values from xst.dec ):

0x00 = $$RD = Open existing file for reading only.
0x01 = $$WR = Open existing file for writing only.
0x02 = $$RW = Open existing file for reading and writing.
0x03 = $$WRNEW = Open new file for writing only.
0x04 = $$RWNEW = Open new file for reading and writing.
0x10 = $$RDSHARE = Open existing file for reading only.
0x20 = $$WRSHARE = Open existing file for writing only.
0x30 = $$RWSHARE = Open existing file for reading and writing.

Opening an existing file prepares the existing file for reading and/or writing, or if no file yet exists, creates a new file. Opening a new file deletes any existing file with the same name before it creates the new, empty file. The filenumber of the opened file is returned.

FUNCTION UpperFile (filename$, newname$)
ifile = OPEN (filename$, $$RD)
ofile = OPEN (newname$, $$WRNEW)
length = LOF (ifile)
a$ = NULL$ (length)
READ [ifile], a$
WRITE [ofile], a$
CLOSE (ifile)
CLOSE (ofile)
END FUNCTION

OR
XOR

binary
bitwise
operator

integers = integers OR integers

Bitwise OR two integer operands to produce an integer result.

a = 0x05F5
b = 0xFFA0
c = a OR b ' c = 0xFFF5

POF()

intrinsic

integer = POF( fileNumber ) 

Return the position of the file pointer for an open diskfile. The argument is the filenumber of the open file.

ifile = OPEN (filename$, $$RD) ' open a file to read
final = LOF(ifile) ' final = length of filename$
line$ = INFILE$(ifile) ' line$ = first text line in file
pos = POF(ifile) ' pos = file pointer after first line

PRINT

statement

PRINT [ [fileNumber , ] ] [ arguments ] [ , | ; ] 

Print numeric and/or string arguments to display screen or disk file. No space is printed between arguments separated by a semi-colon, though each subsequent semi-colon prints one space.  Arguments preceded by a comma are spaced to the next tab position before they are printed. A semi-colon at the end of the argument list suppresses the newline character ( "\n" ) that is otherwise printed.

age = 25
name$ = "Sophia"
a = 4
b$ = "cat"
c# = -3.3
PRINT ' Print a blank line
PRINT [ofile] ' Print a blank line to a file
PRINT "Her age is"; age ' Print "Her age is 25"
PRINT "Her age is";;; age ' Print "Her age is 25"
PRINT "Her name is "; name$ ' Print "Her name is Sophia"
PRINT "Her name is", name$ ' Print "Her name is Sophia"
PRINT "Her name is",, name$ ' Print "Her name is Sophia"
PRINT a; b$; c ' Print " 4cat-3.3"
PRINT a, b$, c ' Print " 4 cat -3.3"
PRINT c; b$, a ' Print "-3.3cat 4"
PRINT [ofile], a, b, c ' Print " 4 cat -3.3" to ofile

PROGRAM

statement

PROGRAM " name "

Begin and name a program. Argument must be a literal string. PROGRAM statements are required when compiling libraries.

PROGRAM "xma"

PROGRAM$()

intrinsic

string = PROGRAM$( integer )

Return program name defined in PROGRAM statement.

program$ = PROGRAM$(0)

QUIT()

intrinsic

[integer = ] QUIT( integer ) 

Quit a program and return to program that ran this one, which usually is the operating system. The return value is lost since the program is terminated before it can return from the call. The argument is passed to the program that ran the current program.

IF #terminate THEN
DisasterHandler () ' prepare for quit
QUIT() ' quit the program
END IF

RCLIP$()

See LCLIP$()

READ

statement

READ [ fileNumber ] , variables

Read data from a disk file into variables. The first argument is the filenumber of the file to read from. The variables can be any combination of numeric variables, string variables, composite variables, composite variable components, or one dimensional arrays of any type except strings.

The number of bytes read into each variable equals the data size of the variable. For example, one byte is read into SBYTE and UBYTE variables, two bytes into SSHORT and USHORT variables, etc.

This is true even though simple variables shorter than 32-bit are held in memory as 32-bit or 64-bit values. In cases where the data size and storage size are not equal, the data size is read, zero or sign-extended to 32-bits or 64-bits, then saved in the storage variable.

When data is read into a string variable, the number of bytes needed to fill the string are read directly into the string, overwriting the previous contents.

When data is read into an array variable, the number of bytes needed to fill the array are read directly into the array, overwriting the previous contents.

READ and WRITE are complementary statements.

DIM a[31]
DIM a#[63]
a$ = NULL$(256)
READ [ifile], a@@, b@@, c@@ ' read 1 byte each into UBYTE variables
READ [ifile], a, b, c ' read 4 bytes each into XLONG variables
READ [ifile], a!, b!, c! ' read 4 bytes each into SINGLE variables
READ [ifile], a#, b#, c# ' read 8 bytes each into DOUBLE variables
READ [ifile], a$ ' read 256 bytes to fill STRING a$
READ [ifile], a[] ' read 128 bytes to fill XLONG a[31]
READ [ifile], a#[] ' read 512 bytes to fill DOUBLE a#[63]
READ [ofile], pixel ' read all bytes in composite variable
READ [ofile], pixel.color ' read all bytes in component
READ [ofile], name.kid[] ' read all bytes in component array

REDIM

See DIM

RETURN
EXIT FUNCTION

statement

RETURN [expression]
EXIT FUNCTION [expression]

Return from the currently executing function to the one that called it. The value of the expression is returned to the calling function. If no expression is given, a zero or empty string is returned.

RETURN ' return zero or empty string
RETURN a ' return value of a
RETURN a$ ' return string a$
RETURN ((a+b)*(c+d)) ' return value of numeric expression
RETURN (a$ + b$ + c$) ' return value of string expression

RIGHT$()

See LEFT$()

RINCHR()

See INCHR()

RINCHRI()

See INCHR()

RINSTR()

See INSTR()

RINSTRI()

See INSTR()

RJUST$()

See CJUST$()

ROTATER()

instrinsic

integer = ROTATER( integer, count ) 

Closed rotate bits right any number of bits. Bits shifted out the least significant bit are recirculated back into the most significant bit.

x = 0xDEADC0DE
y = 0x01020304
a = ROTATER(x, 16) ' a = 0xC0DEDEAD
a = ROTATER(y, 4) ' a = 0x40102030

RTRIM$()

See TRIM$()

SBYTE

See Declarations after the alphabetical listing. 

SBYTE()

See Type Conversions after the alphabetical listing. 

SBYTEAT()

See Direct Memory Access after the alphabetical listing. 

SCOMPLEX

statement

[scope] SCOMPLEX variables

Declare single precision complex variables.

Also see Declarations after the alphabetical listing.

SCOMPLEX ii, jj, kk
SCOMPLEX x[], y[], z[]
SHARED SCOMPLEX a, b, c, a[], b[], c[]

SEEK()

intrinsic

[filePointer = ] SEEK( fileNumber, filePointer ) 

Move the file pointer of a file to a new position. The new position can be beyond the end of the file.

SEEK (dataFile, recordNumber * recordSize)
fp = SEEK(ifile, d3)

SELECT CASE
END SELECT

statement

SELECT CASE TRUE 
SELECT CASE FALSE 
SELECT CASE expression
SELECT CASE ALL TRUE 
SELECT CASE ALL FALSE 
SELECT CASE ALL expression
END SELECT 

Begin a multi-way decision block and establish the test expression that subsequent CASE statements test against. The test expression can be TRUE, FALSE, or a numeric or string expression.

Each expression in the subsequent CASE statements is tested against the test expression. If any expression matches the test expression, the statements following the CASE statement are executed, up to the next CASE or END SELECT statement.

To match TRUE requires a non-zero number or a non-empty string. To match FALSE requires a zero number or an empty string. To match expression requires an equal numeric value or string.

Normal SELECT CASE blocks are called one-of-many decision blocks because at most one CASE statement block is executed. This occurs because an invisible jump past the matching END SELECT is inserted before every CASE statement except the first.

SELECT CASE ALL blocks are called n-of-many decision blocks because all CASE statements are tested for matches.  Whether or not the code in the preceding block was executed, tests are performed for each successive CASE statement.

END SELECT marks the end of every SELECT CASE block.

SELECT CASE a ' test against the contents of a
SELECT CASE a$ ' test against the contents of a$
SELECT CASE TRUE ' test for non-zero or non-empty string
SELECT CASE FALSE ' test for zero or empty string
SELECT CASE ALL a ' test all cases against the contents of a
SELECT CASE ALL a$ ' test all cases against the contents of a$
SELECT CASE ALL TRUE ' test all cases for non-zero or non-empty$
SELECT CASE ALL FALSE ' test all cases for zero or empty string
'
SELECT CASE x
CASE a : PRINT "a = x"
CASE b,c,d : PRINT "a or b or c = x"
CASE e+f : PRINT "a = e+f"
CASE ELSE : PRINT "None of the above"
END SELECT
'
SELECT CASE ALL TRUE
CASE i, j, k : PRINT "i or j or k is non-zero"
CASE humidity > 100 : PRINT "The sky is falling"
CASE a$, b$+c$ : PRINT "a$ or b$+c$ is has contents"
CASE !raining : PRINT "You can go out now"
CASE ERROR(-1) : PRINT "Something bad happened"
CASE hope[] : PRINT "There is hope[]"
CASE ALL : PRINT "All printed are true"
END SELECT

SET()

See CLR()

SFUNCTION

See FUNCTION

SGN()
SIGN()

intrinsic

integer = SGN( numeric ) 
integer = SIGN( numeric ) 

Return the sign of a number. If the argument is negative, return -1 . If the argument is positive, return +1 . If the argument is zero, SGN() returns 0 while SIGN() returns +1 . 

i = -23
j = 0
k = +74
x# = -123.4
y# = +.0002
PRINT SGN(i), SIGN(i) ' Print "-1 -1"
PRINT SGN(j), SIGN(j) ' Print " 0 +1"
PRINT SGN(k), SIGN(k) ' Print "+1 +1"
PRINT SGN(x#), SIGN(x#) ' Print "-1 -1"
PRINT SGN(y#), SIGN(y#) ' Print "+1 +1"

SHARED

See Declarations after the alphabetical listing. 

SHELL()

intrinsic

[integer = ] SHELL( command$ ) 

Execute a program. The command string executes as it would at an operating system prompt except the full program name including extent must be specified. Control then returns control to the program. Some operating systems support concurrent execution of both processes, meaning the program does not wait until the newly started program completes.

SHELL ("xb.exe acircle.x -bc") ' wait for xb.exe to complete
SHELL (":xb.exe acircle.x -bc") ' execute concurrently if supported

SIGN()

See SGN()

SIGNED$()

See STRING()

SINGLE

See Declarations after the alphabetical listing. 

SINGLE()

See Type Conversions after the alphabetical listing. 

SINGLEAT()

See Direct Memory Access after the alphabetical listing. 

SIZE()

intrinsic

integer = SIZE( typename ) 
integer = SIZE( variable ) 
integer = SIZE( array []) 
integer = SIZE( array [ n ]) 
integer = SIZE( array [ n ,]) 
integer = SIZE( composite ) 
integer = SIZE( composite.component ) 
integer = SIZE( composite.component []) 
integer = SIZE( composite.component [ n ]) 
integer = SIZE( composite.componentString ) 

Return the size of data in bytes. The argument can be a built-in or user-defined typename, a numeric or string variable, the highest dimension of an array [] , an array [ n ] element, an intermediate dimension of an array [ n ,] , a composite variable, a component of a composite variable, a component [] array, a component [ n ] array element, or a componentString.

name$ = "John Galt"
a = SIZE(SLONG) ' size of built-in type SLONG (4 bytes)
a = SIZE(COLOR) ' size of user-defined composite type COLOR
a = SIZE(employee) ' size of variable 'employee'
a = SIZE(name$) ' size of string variable (9 bytes)
a = SIZE(prog[]) ' size of highest dimension of prog[]
a = SIZE(prog[n,] ' size of sub-array prog[n, ]
a = SIZE(prog[m,] ' size of sub-array prog[m, ]
a = SIZE(box) ' size of composite variable box
a = SIZE(box.top) ' size of composite.component box.top
a = SIZE(box.ele[]) ' size of composite.array box.ele[]
a = SIZE(box.ele[1]) ' size of composite.array element box.ele[1]
a = SIZE(box.name) ' size of composite string box.name

SLONG

See Declarations after the alphabetical listing. 

SLONG()

See Type Conversions after the alphabetical listing. 

SLONGAT()

See Direct Memory Access after the alphabetical listing. 

SMAKE()

intrinsic

single = SMAKE( integer ) 

Change the type of a 32-bit integer to SINGLE . The bit pattern of the return value is the same as the integer argument, but the return type is SINGLE . 

x = 0x48000000 ' x = 0x48000000 ( a large integer number)
a! = SMAKE(x) ' a! = 0s48000000 ( a small SINGLE number)

SPACE$()

intrinsic

string = SPACE$( length ) 

Create a string of space characters. The length of the return string is given by the argument.

a$ = SPACE$(4) ' a$ = " "
a$ = "x" + SPACE$(2) + "x" ' a$ = "x x"

SSHORT

See Declarations after the alphabetical listing. 

SSHORT()

See Type Conversions after the alphabetical listing. 

SSHORTAT()

See Direct Memory Access after the alphabetical listing. 

STATIC

See Declarations after the alphabetical listing. 

STEP

See FOR

STRING()
STRING$()
SIGNED$()
STR$()

intrinsic

string = STRING( numeric ) 
string = STRING$( numeric ) 
string = SIGNED$( numeric ) 
string = STR$( numeric ) 

Convert a numeric argument into a string. The only difference between these intrinsics is the form the sign takes in the returned string. STRING() and STRING$() puts a leading "-" on negative numbers and nothing on positive numbers. SIGNED$() puts a leading "+" or "-" on all numbers, including "+0" . STR$() puts a leading "-" on negative numbers and a leading space character " " on positive numbers.

a# = -23.456
b# = +11.111
a$ = STRING(a#) + STRING(b#) ' a$ = "-23.45611.111"
a$ = STRING$(a#) + STRING$(b#) ' a$ = "-23.45611.111"
a$ = SIGNED$(a#) + SIGNED$(b#) ' a$ = "-23.456+11.111"
a$ = STR$(a#) + STR$(b#) ' a$ = "-23.456 11.111"

STUFF$()

intrinsic

string = STUFF( stringInto$, stringFrom$, start ) 
string = STUFF( stringInto$, stringFrom$, start, length ) 

Stuff one string into another. Stuff stringFrom$ into stringInto$ starting at start. Stuff no more than length characters.

x$ = "This lazy man"
y$ = "flabberghast"
z$ = "is wolf"
a$ = STUFF$(x$, y$, 6, 4) ' a$ = "This flab man"
a$ = STUFF$(x$, y$, 6) ' a$ = "This flabberg"
a$ = STUFF$(x$, z$, 6) ' a$ = "This is wolfn"
a$ = STUFF$(x$, z$, 6, 5) ' a$ = "This is woman"

SUB
EXIT SUB
END SUB

statement

SUB SubroutineName

SUB - Begin subroutine.
EXIT SUB - Exit subroutine before its end.
END SUB - End subroutine.

A subroutine is a portion of a function that can be called only from within the same function by GOSUB SubroutineName.

END SUB returns to the statement following the GOSUB .
EXIT SUB jumps to the END SUB which then returns.

SUB Sandwitch
entry = Convert (a, b)
IFZ entry THEN EXIT SUB ' exit the subroutine
entry = Chew (a, b)
END SUB

SUBADDR

See Declarations after the alphabetical listing. 

SUBADDR()

See Type Conversions after the alphabetical listing. 

SUBADDRAT()

See Direct Memory Access after the alphabetical listing. 

SUBADDRESS()

intrinsic

subaddr = SUBADDRESS( label ) 

Return the address of a subroutine.

g = SUBADDRESS (SubName) ' g = address of subroutine SubName
h[i] = SUBADDRESS (SumArray) ' h[i] = address of subroutine SumArray

SWAP

statement

SWAP string, string
SWAP variable, variable
SWAP arrayNode, arrayNode

Swap the contents of:
  string variables
  numeric variables of the same type
  array elements of the same type
  strings, arrays, array nodes

SWAP a, b ' swap XLONG variables
SWAP a#, b# ' swap DOUBLE variables
SWAP a$, b$ ' swap STRING variables
SWAP a, b[n] ' swap XLONG variable with XLONG array element
SWAP a[i], b[j] ' swap XLONG array elements
SWAP a$[i], b$[j] ' swap STRING array elements
SWAP a$[i], b$ ' swap STRING array element with string
SWAP a[], b[] ' swap two entire arrays
SWAP a[], b[i,] ' swap array with a sub-array
SWAP a[i,], b[i,] ' swap two sub-arrays

TAB()

intrinsic

TAB( integer ) 

Append spaces to PRINT string to reach a horizontal character position. TAB() is valid only in PRINT statements.

PRINT a; TAB(10); b; TAB(24); c; TAB(40); d$; TAB(60); e
PRINT TAB(40); x, y, z

THEN

See IF

TO

See FOR

TRIM$()
LTRIM$()
RTRIM$()

intrinsic

string = TRIM$( string ) 
string = LTRIM$( string ) 
string = RTRIM$( string ) 

Trim whitespace and non-printable characters from both ends of a string, the left end of a string, or the right end of a string. All characters from 0x00 to 0x20 and 0x80 to 0xFF are removed.

x$ = "\n\nXXX\t\0\1\2 "
y$ = "\t \nZZZ \t\t\n"
a$ = LTRIM$(x$) ' a$ = "XXX\t\0\1\2 "
a$ = LTRIM$(y$) ' a$ = "ZZZ \t\t\n"
a$ = RTRIM$(x$) ' a$ = "\n\nXXX"
a$ = RTRIM$(y$) ' a$ = "\t \nZZZ"
a$ = TRIM$(x$) ' a$ = "XXX"
a$ = TRIM$(y$) ' a$ = "YYY"

TRUE

See SELECT CASE

TYPE
UNION
END TYPE

statement

TYPE TypeName
UNION 
END TYPE
END UNION 

Declare user-defined composite types and begin/end union overlays. UNION statements are valid only within TYPE declaration blocks.

TYPE COLOR
USHORT .red
USHORT .green
USHORT .blue
USHORT .intensity
END TYPE
'
TYPE POINT
XLONG .x
XLONG .y
COLOR .color
END TYPE
'
TYPE LINE
POINT .a
POINT .b
XLONG .thickness
END TYPE
'
TYPE DPOINT
DOUBLE .x
DOUBLE .y
COLOR .color
END TYPE
'
TYPE ARBITRARY ' hold an arbitrary data type value
UNION ' the following overlay each other
SBYTE .sbyte
UBYTE .ubyte
SSHORT .sshort
USHORT .ushort
SLONG .slong
ULONG .ulong
XLONG .xlong
GIANT .giant
SINGLE .single
DOUBLE .double
SCOMPLEX .scomplex
DCOMPLEX .dcomplex
END UNION ' end overlay
XLONG .type ' type currently stored in the variable
END TYPE

TYPE()

intrinsic

integer = TYPE( typeName ) 
integer = TYPE( typeName.component ) 
integer = TYPE( variable ) 
integer = TYPE( variable.component ) 
integer = TYPE( array []) 
integer = TYPE( array [ subscripts ,]) 

Return the type number of a built-in type, composite type, composite type component, variable, component of a composite variable, array, or array node.

Shared constants are defined for the built-in types. User-defined types are assigned during compilation. A given user-defined type is not necessarily assigned the same type number on subsequent compilations, or from library to library. Don't make any assumptions about the assignment of type numbers in function libraries or other external modules.

a = TYPE(SLONG) ' a = type number of SLONG ($$SLONG)
a = TYPE(DCOMPLEX) ' a = type number of DCOMPLEX ($$DCOMPLEX)
a = TYPE(DCOMPLEX.I) ' a = type number of component ($$DOUBLE)
a = TYPE(employee) ' a = type number of variable employee
a = TYPE(maxValue[]) ' a = type number of array maxValue[]
a = TYPE(prog[func,]) ' a = type number of node ($$XLONG)
a = TYPE(employee.salary) ' a = type number of variable component

UBOUND()

intrinsic

integer = UBOUND( string ) 
integer = UBOUND( array []) 
integer = UBOUND( array [ subscripts ,]) 

Return the upper bound of a string or array dimension.

x$ = ""
y$ = "0"
z$ = "012345"
DIM a[]
DIM b[0]
DIM c[7]
DIM d[3,]
DIM x[11]
DIM y[15]
DIM z[31]
ATTACH x[] TO d[0]
ATTACH y[] TO d[1]
ATTACH z[] TO d[2]
a = UBOUND(x$) ' a = -1 ( empty string )
a = UBOUND(y$) ' a = 0 ( upper bound = 0 : 1 element )
a = UBOUND(z$) ' a = 5 ( upper bound = 5 : 6 elements )
a = UBOUND(a[]) ' a = -1 ( empty array )
a = UBOUND(b[]) ' a = 0 ( upper bound = 0 : 1 element )
a = UBOUND(c[]) ' a = 7 ( upper bound = 7 : 8 elements )
a = UBOUND(d[]) ' a = 3 ( upper bound of highest dimension )
a = UBOUND(d[0,]) ' a = 11 ( upper bound of d[0,] )
a = UBOUND(d[1,]) ' a = 15 ( upper bound of d[1,] )
a = UBOUND(d[2,]) ' a = 31 ( upper bound of d[2,] )
a = UBOUND(d[3,]) ' a = -1 ( d[3,] is an empty array )

UBYTE

See Declarations after the alphabetical listing. 

UBYTE()

See Type Conversions after the alphabetical listing. 

UBYTEAT()

See Direct Memory Access after the alphabetical listing. 

UCASE$()

See LCASE$()

ULONG

See Declarations after the alphabetical listing. 

ULONG()

See Type Conversions after the alphabetical listing. 

ULONGAT()

See Direct Memory Access after the alphabetical listing. 

UNION

See TYPE

UNTIL

See DO

USHORT

See Declarations after the alphabetical listing. 

USHORT()

See Type Conversions after the alphabetical listing. 

USHORTAT()

See Direct Memory Access after the alphabetical listing. 

VERSION

statement

VERSION " number "

Give the program a version number. Argument must be literal string.

VERSION "0.1234"

VERSION$()

intrinsic

string = VERSION$( integer )

Return version number string defined in VERSION statement.

version$ = VERSION$(0)

VOID

See DECLARE and FUNCTION

WHILE

See DO

WRITE

statement

WRITE [ fileNumber ] , variables

Write variables to a disk file. The first argument is the filenumber of the file to write to. The remaining arguments are any combination of numeric variables, string variables, composite variables, composite variable components, or one dimensional arrays of any type except strings.

The number of byte written from each variable equals the data size of the variable. For example, one byte is written from SBYTE and UBYTE variables, two bytes from SSHORT and USHORT variables, four bytes from SLONG and SINGLE variables, etc.

This is true even though simple variables shorter than 32-bits are held in memory as 32-bit or 64-bit values. In cases where the data size and storage size are not equal, the least significant part of the variable is written.

When a string variable is written, the number of bytes written is the number of bytes in the string..

When an array variable is written, the number of bytes written is the number of bytes in the array. Only one dimension can be written.

DIM a[31] ' a[] contains 32 XLONG values
DIM a#[63] ' a#[] contains 64 DOUBLE values
a$ = CHR$('*', 256) ' a$ contains 256 '*' characters
WRITE [ifile], a@, b@, c@ ' WRITE 1 byte each from SBYTE variables
WRITE [ifile], a, b, c ' WRITE 4 bytes each from XLONG variables
WRITE [ifile], a!, b!, c! ' WRITE 4 bytes each from SINGLE variables
WRITE [ifile], a#, b#, c# ' WRITE 8 bytes each from DOUBLE variables
WRITE [ifile], a$ ' WRITE all 256 bytes from STRING a$
WRITE [ifile], a[] ' WRITE all 128 bytes from XLONG a[31]
WRITE [ifile], a#[] ' WRITE all 512 bytes from DOUBLE a#[63]
WRITE [ofile], pixel ' WRITE all bytes in composite variable
WRITE [ofile], pixel.color ' WRITE all bytes in component
WRITE [ofile], name.kid[] ' WRITE all bytes in component array

XLONG

See Declarations after the alphabetical listing. 

XLONG()

See Type Conversions after the alphabetical listing. 

XLONGAT()

See Direct Memory Access after the alphabetical listing. 

XMAKE()

intrinsic

xlong = XMAKE( integer ) 
xlong = XMAKE( single ) 

Make an XLONG value from an integer or single argument.

x! = 2.000
a = XMAKE(x!) ' a = XLONG with same bit pattern as x!