Xylem System 5000 BASIC Manual User Manual
Page 35

33
Basic Commands and Functions
Used within a subroutine, LOCAL marks the given variable as valid only within that subroutine.
SUB change_var()
LOCAL var
var = 100
PRINT “var: “, var REM prints “var: 100”
END SUB
var = 10
change_var()
PRINT “var: “, var REM prints “var: 10” (would print 100 if not LOCAL)
LOCAL
Returns the common (base-10) logarithm of the given number. The LN function should be used if a
natural logarithm is required.
var = LOG(5) REM stores “0.69897”
var = LOG(10)
REM stores “1”
LOG (number)
Declares the end of a DO-LOOP statement.
DO
PRINT “ “, var; REM prints “ 0 1 2 3 4 5 6 7 8 9”
var = var + 1
IF (var >= 10) BREAK
LOOP
LOOP
Returns the given string as all lowercase.
PRINT LOWER$(“Hello World”) REM prints “hello world”
LOWER$ (string)
Returns the given string with all whitespace removed from only the left side.
var$ = LTRIM$(“ Hello World “) REM stores “Hello World “
LTRIM$ (string)
Returns the maximum value of the two given numbers.
a = RND() // generates a random number between 0 and 1
b = RND() // generates a random number between 0 and 1
c = MAX(a, b) REM stores the largest of the two into c
MAX (number, number)