XBasic keywords maxreason@gmail.com max reason

XBasic web-pages

XBasic overview - features, capabilities, screenshots.
XBasic newsbits - the latest news and views of XBasic.
XBasic freeware - download & installation instructions.
XBasic questions - frequently asked questions -- FAQs.
XBasic quick-start - begin programming XBasic quickly.
QuickBasic to XBasic - translate QuickBasic to XBasic.
QuickBasic keywords - QuickBasic to XBasic keywords.
XBasic documentation - complete HTML documentation online.
XBasic keywords/operators/scopes/types - language reference.
XBasic projects - enhance & extend applications & documentation.
XBasic e-links - other web-sites with XBasic samples and information.
XBasic forum - mail-list forum for all XBasic programmers - questions, answers, advice, samples, etc.

  comments, suggestions, corrections


XBasic types
XBasic scopes
XBasic operators
XBasic keywords - 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


XBasic types

The following table briefly describes every XBasic data-type.

suf bits form data type minimum maximum comment
@ 8 s SBYTE -128 +127 signed 8-bit integer
@@ 8 u UBYTE 0 +255 unsigned 8-bit integer
% 16 s SSHORT -32768 +32767 signed 16-bit integer
%% 16 u USHORT 0 +65535 unsigned 16-bit integer
& 32 s SLONG -2147483648 +2147483647 signed 32-bit integer
&& 32 u ULONG 0 +4294967395 unsigned 32-bit integer
~ cpu x XLONG MIN SLONG MAX ULONG signed 32-bit integer
cpu x GOADDR MIN XLONG MAX XLONG unsigned 32-bit address
cpu x SUBADDR MIN XLONG MAX XLONG unsigned 32-bit address
cpu x FUNCADDR MIN XLONG MAX XLONG unsigned 32-bit address
$$ 64 s GIANT -9223372036854775808 +9223372036854775807 signed 64-bit integer
! 32 f SINGLE -1e38 +1e38 ieee 32-bit floating point
# 64 f DOUBLE -1e308 +1d308 ieee 64-bit floating point
2*32 f SCOMPLEX SINGLE DOUBLE SINGLE complex number
2*64 f DCOMPLEX DOUBLE DOUBLE DOUBLE complex number
$ 8 u STRING 0 +255 string of UBYTE chars

XBasic scopes

The following table briefly describes every XBasic scope.

pre scope lifetime accessible comment
AUTO function function temporary, local, maybe in CPU register
AUTOX function function temporary, local, never in CPU register
STATIC program program permanent, local
# SHARED program program permanent, shared with program
## EXTERNAL program linked permanent, shared with linked module

XBasic operators

The following table briefly describes every XBasic keyword.

op alt kind operands returns class prec comment
& unary any-type XLONG 11 12 address of data
&& unary any-type XLONG 11 12 address of handle
NOT ~ unary integer same-type 10 12 not - bitwise
! unary numeric TRUE/FALSE 9 12 not - logical : true if 0 / empty
!! unary numeric TRUE/FALSE 9 12 test - logical : false if 0 / empty
+ unary numeric same-type 8 12 positive - sign
- unary numeric same-type 8 12 negative - sign
<<< binary integer left-type 7 11 up-shift - arithmetic / signed
>>> binary integer left-type 7 11 down-shift - arithmetic / signed
<< binary integer left-type 7 11 up-shift - logical / shift in zero
>> binary integer left-type 7 11 down-shift - logical / shift in zero
** binary numeric high-type 4 10 power - raise to power
/ binary numeric high-type 4 9 divide
* binary numeric high-type 4 9 multiply
\ binary numeric integer 6 9 divide - integer
MOD binary numeric integer 6 9 modulus - integer remainder
+ binary numeric high-type 5 8 add
+ binary string STRING 5 8 concatenate
- binary numeric high-type 4 8 subtract
AND & binary integer high-type 3 7 and - bitwise
XOR ^ binary integer high-type 3 6 xor - bitwise
OR | binary integer high-type 3 6 or - bitwise
> !<= binary num-str TRUE/FALSE 2 5 greater-than
>= !< binary num-str TRUE/FALSE 2 5 greater-or-equal
<= !> binary num-str TRUE/FALSE 2 5 less-or-equal
< !>= binary num-str TRUE/FALSE 2 5 less-than
<> != binary num-str TRUE/FALSE 2 4 not-equal
= == binary num-str TRUE/FALSE 2 4 equal
&& binary integer TRUE/FALSE 1 3 and - logical
^^ binary integer TRUE/FALSE 1 2 xor - logical
|| binary integer TRUE/FALSE 1 2 or - logical
= binary num-str right-type 1 assignment

XBasic keywords

The following table briefly describes every XBasic keyword.

XBasic keywords - 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

This table is a very valuable resource, so everyone is encouraged to help enhance and extend it.   Eventually every keyword should hyperlink to a detailed description of the keyword, including examples.

s = statement, o = operator, i = intrinsic-function, m = math-function library (looks like an intrinsic)

 kind  keyword comment
 
i ABS() absolute value of number
m ACOS() arc-cosine
m ACOSH() arc-hyperbolic-cosine
m ACOT() arc-cotangent
m ACOTH() arc-hyperbolic-cotangent
m ACSC() arc-cosecant
m ACSCH() arc-hyperbolic-cosecant
s ALL execute all matching cases in SELECT CASE blocks
o AND bitwise AND operator
i ASC() numeric value of character in string
m ASEC() arc-secant
m ASECH() arc-hyperbolic-secant
m ASIN() arc-sine
m ASINH() arc-hyperbolic-sine
m ATAN() arc-tangent
m ATANH() arc-hyperbolic-tangent
s ATTACH attach array/subarray/string to another
s AUTO scope - automatic and local - maybe in CPU register
s AUTOX scope - automatic and local - not in CPU register
 
i BIN$() create binary format string
i BINB$() create binary format string with leading 0b
i BITFIELD() define bitfield constant or variable
 
s CASE one case in SELECT CASE block
s CFUNCTION declare/define C-protocol function
i CHR$() string of characters of an integer value
i CJUST$() center string in field of space characters
s CLEAR not implemented
i CLOSE() close and open file
i CLR() clear bitfield in integer
m COS() cosine
m COSH() hyperbolic-cosine
m COT() cotangent
m COTH() hyperbolic-cotangent
m CSC() cosecant
m CSCH() hyperbolic-cosecant
i CSIZE() number of characters in string before first 0x00
i CSIZE$() string of characters up to first 0x00
i CSTRING$() convert C string to XBasic string
   
s DCOMPLEX data-type : complex number with DOUBLE elements
s DEC decrement by 1
s DECLARE declare function
i DHIGH() extract high 32-bits from 64-bit DOUBLE
s DIM dimension an array and zero its contents
i DLOW() extract low 32-bits from 64-bit DOUBLE
i DMAKE() make 64-bit DOUBLE from two 32-bit integers
s DO begin a DO ... LOOP block
s DOUBLE data-type : ieee 64-bit floating point
i DOUBLE() convert value to DOUBLE data-type
i DOUBLEAT() read DOUBLE value from memory
i DOUBLEAT() write DOUBLE value to memory
   
s ELSE begin alternate block in IF ... THEN ... ELSE ... ENDIF block
s END END of - program, function, block-structure
s ENDIF END of multi-line IF block
i EOF() is file-pointer at or beyond the end of an open file
i ERROR() return previous error and optionally set new error value
i ERROR$() return error string given an error number
s EXIT exit a block structure - DO, WHILE, FOR, IF, SELECT CASE
m EXP() exponential - e to the x power
m EXP10() exponential - 10 to the x power
s EXPORT put declared functions and constants in .DEC file
s EXTERNAL scope - share with statically linked modules
i EXTS() extract signed bitfield from integer
i EXTU() extract unsigned bitfield from integer
   
s FALSE in SELECT CASE - means zero or empty
i FIX() integer value, round toward zero
s FOR begin FOR ... NEXT loop
i FORMAT$() create a formatted string
s FUNCADDR data-type - function address
i FUNCADDR() convert value to FUNCADDR data-type
i FUNCADDRESS() address of a function
s FUNCTION function declaration or definition
   
i GHIGH() extract high 32-bits from GIANT value
s GIANT data-type - 64-bit signed integer
i GIANT() convert value to GIANT data-type
i GIANTAT() read GIANT value from memory
i GIANTAT() write GIANT value to memory
i GLOW() extract low 32-bits from GIANT value
i GMAKE() create 64-bit GIANT value from low & high 32-bit integers
s GOADDR data-type - address of GOTO label
i GOADDR() convert value to GOADDR data-type
i GOADDRESS() address of GOTO label
s GOSUB call a local subroutine
s GOTO jump to a local label
   
i HEX$() create hexadecimal format string
i HEXX$() create hexadecimal format string with leading 0x
i HIGH0() find most-significant 0 bit
i HIGH1() find most-significant 1 bit
   
s IF begin IF statement or IF block - if non-zero or non-empty
s IFF begin IF statement or IF block - if zero or empty
s IFT begin IF statement or IF block - if non-zero or non-empty
s IFZ begin IF statement or IF block - if zero or empty
s IMPORT read and process a .DEC declaration file
s INC increment by 1
i INCHR() find first character in string that matches one of a set
i INCHRI() same as INCHR( ) except case insensitive
i INFILE$() input string from an open file
i INLINE$() input string from console
i INSTR() find a string within another string
i INSTRI() same as INSTR( ) except case insensitive
i INT() integer value, round to nearest integer
s INTERNAL declare function visible only within this program
   
i LCASE$() convert string to lower case
i LCLIP$() clip characters from left end of string
i LEFT$() get characters from left end of string
i LEN() length of string or array = # of elements
s LIBRARY name this function library
i LIBRARY$() name of this function library
i LJUST$() left justify string in field of space characters
i LOF() length of open file
m LOG() natural logarithm
m LOG10() base 10 logarithm
s LOOP end DO ... LOOP block
i LTRIM$() trim whitespace from left end of string
   
i MAKE() make a bitfield
i MAX() maximum of two values
i MID$() extract any portion of string
i MIN() minimum of two values
o MOD modulus = remainder from division
   
s NEXT end of FOR ... NEXT block
o NOT operator - bitwise NOT = invert all bits
i NULL$() create string of 0x00 null characters
   
i OCT$() octal format string
i OCTO$() octal format string with leading 0o
i OPEN() open a file
o OR operator - bitwise OR
   
i POF() position of file-pointer in open file
s PRINT print to console or open file
s PROGRAM name this program
i PROGRAM$() name of this program
   
s QUIT terminate program execution
   
i RCLIP$() clip characters from right end of string
s READ read from file into variables
s REDIM redimension array, preserve contents
s RETURN return from function
i RIGHT$() get characters from right end of string
i RINCHR() reverse direction INCHR( )
i RINCHRI() reverse direction INCHRI( )
i RINSTR() reverse direction INSTR( )
i RINSTRI() reverse direction INSTRI( )
i RJUST$() right justify string in field of spaces
i ROTATEL() circular rotate bits to the left
i ROTATER() circular rotate bits to the right
i RTRIM$() trim whitespace character from right end of string
   
s SBYTE data-type - signed 8-bit integer
i SBYTE() convert to SBYTE data-type
i SBYTEAT() read SBYTE value from memory
i SBYTEAT() write SBYTE value to memory
s SCOMPLEX data-type - complex number with SINGLE elements
m SEC() secant
m SECH() hyperbolic-secant
i SEEK() move file-pointer in open file
s SELECT begin SELECT CASE block
i SET() set a range of bits
s SFUNCTION declare or define operating-system protocol function
i SGN() sign of number : -1, 0, +1
s SHARED scope - shared within program
i SHELL() execute command line string
i SIGN() sign of number : -1, +1
i SIGNED$() convert to STRING data-type, leading "-" or "+" sign
m SIN() sine
m SINH() hyperbolic-sine
s SINGLE data-type - ieee 32-bit floating point
i SINGLE() convert to SINGLE data-type
i SINGLEAT() read SINGLE value from memory
i SINGLEAT() write SINGLE value to memory
i SIZE() size of string or array in bytes
s SLONG data-type - signed 32-bit integer
i SLONG() convert to SLONG data-type
i SLONGAT() read SLONG value from memory
i SLONGAT() write SLONG value to memory
i SMAKE() make SINGLE value the bit image of a 32-bit integer
i SPACE$() create string of space characters
m SQRT() square-root
s SSHORT data-type - signed 16-bit integer
i SSHORT() convert to SSHORT data-type
i SSHORTAT() read SSHORT value from memory
i SSHORTAT() write SSHORT value to memory
s STATIC scope - permanent and local to function
s STEP optional size of increment in FOR ... NEXT loops
s STOP stop program execution here
i STR$() convert to STRING data-type, leading "-" or " "
s STRING data-type - string of characters
i STRING() convert to STRING data-type, leading "-"
i STRING$() convert to STRING data-type, leading "-"
i STUFF$() stuff string into another string
s SUB begin a subroutine
s SUBADDR data-type - address of subroutine
i SUBADDR() convert to SUBADDR data-type
i SUBADDRESS() address of subroutine
s SWAP swap contents of two same-type variables or arrays
   
i TAB() append space characters to PRINT string
m TAN() secant
m TANH() hyperbolic-secant
s THEN begin statement in IF ... THEN block
s TO limit in FOR statement
i TRIM$() trim whitespace from both ends of string
s TRUE in SELECT CASE - means non-zero or non-empty
s TYPE begin user-defined data-type AKA composite data-type
i TYPE() return data-type of variable, array, component
   
i UBOUND() upper bound of string or array or subarray
s UBYTE data-type - unsigned 8-bit integer
i UBYTE() convert to UBYTE data-type
i UBYTEAT() read UBYTE from memory
i UBYTEAT() write UBYTE to memory
i UCASE$() convert string to upper case
s ULONG data-type - unsigned 32-bit integer
i ULONG() convert to ULONG data-type
i ULONGAT() read ULONG from memory
i ULONGAT() write ULONG to memory
s UNION begin component overlay in TYPE block
s UNTIL loop condition test in DO and LOOP statements
s USHORT data-type - unsigned 16-bit integer
i USHORT() convert to USHORT data-type
i USHORTAT() read USHORT from memory
i USHORTAT() write USHORT to memory
   
s VERSION assign version number to program or library
i VERSION$() version number of program or library
s VOID function returns no value
   
s WHILE loop condition test in DO and LOOP statements
s WRITE write variables to open file
   
s XLONG data-type - cpu register/address size integer
i XLONG() convert to XLONG data-type
i XLONGAT() read XLONG from memory
i XLONGAT() write XLONG to memory
i XMAKE() retype to XLONG from any data-type
o XOR operator - bitwise exclusive-or