Commands and functions, End sub, End while eof (filenumber) – Xylem STORM 3 Basic Programming manual User Manual

Page 18: Error

Advertising
background image

Returns TRUE if the given filenumber has reached the end of the file, FALSE if there is still data

available to be read from the current position.

OPEN “SiteID.csv” FOR READING AS #1

WHILE (NOT EOF(#1))

LINE INPUT #1, var$ REM reads each line of the log file

WEND

CLOSE #1

16

COMMANDS AND FUNCTIONS

Declares the end of a subroutine (begun with the SUB statement).


volume = calc_volume(3, 4, 5) REM sets volume to 60


SUB calc_volume(h, w, d)

vol = h * w * d

RETURN vol

END SUB

END SUB

Marks the end of a conditional WHILE-WEND loop. END WHILE may also be used instead

of WEND.


x = 0

WHILE (x < 30)

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

x = DATETIME(SECONDS)

END WHILE

END WHILE

EOF (filenumber)

Ends the Basic program with a custom error message. Primarily intended for troubleshooting Basic

programs.

var = 12

IF (var > 10) THEN

ERROR “Number too large!”

REM program ends here

ENDIF

ERROR

Advertising