Xylem STORM 3 Basic Programming manual User Manual

Page 33

Advertising
background image

31

Commands and Functions

Begins a conditional loop encompassed by REPEAT and UNTIL. The condition is given

after the UNTIL statement and while evaluated as TRUE, will continue to iterate through the

loop. Once the UNTIL condition is evaluated as FALSE, the loop exits.

REPEAT

REM Break out of the loop when our seconds are greater than 30

x = DATETIME(SECONDS)

UNTIL (x > 30)

REPEAT

Returns control back to the calling line of a GOSUB call or a subroutine (SUB) call with an optional

value.

REM Calculate the Area of a Rectangle

height = 3

width = 4


area = calc_area(height, width) REM stores 12 in area


SUB calc_area(h, w)

a = h * w

RETURN a

END SUB

RETURN

Begins a comment extending to the end of the line. An apostrophe (“ ‘ ”) may alternatively be used

to start a comment.

REM This is a comment

‘ This is also a comment

var = 1 REM This is a valid comment

var = 2 ‘ This is also a valid comment

REM

Returns a string, starting from the right side, containing the given number of characters from the

given string.

var$ = “A1,B2,C3,D4”

cd$ = RIGHT$(var$, 5)REM sets cd$ to C3,D4

RIGHT$ (string, number)

Advertising