beautypg.com

Xylem System 5000 BASIC Manual User Manual

Page 7

background image

Basic Features and Fundamentals

5

The REM statement (meaning remark) or apostrophe (“ ‘ ”) introduce a comment that extends to

the end of the line. Notice that though REM is a statement as well, it does not require a statement

separator (“:”) if used on the same line as another statement.

REM This is a comment

‘ This is also a comment

PRINT “Hello World” REM This is a valid comment

PRINT “Hello World” : REM This is a valid comment with a separator

PRINT “Hello World” ‘ This is also a valid comment

Comments

Unlike the case-insensitive nature of Basic statements, variables and strings are uniquely

identified by their names. Thus “var” is understood to be different than “Var”.

var = 15.2

PRINT “var: “, var REM prints “var: 15.2”
PRINT “Var: “, Var REM prints “Var: 0”

String variables may be used and require a trailing “$”.

var$ = “Hello World”
PRINT “var$: “, var$ REM prints “var$: Hello World”

Traditional variables do not need to be declared before their first use. Number variables are

initialized to zero (“0”) while string variables are initialized to an empty string (“”). Arrays, on

the other hand, need to be created first using the ARRAY command. Array contents are

initialized to zeros or empty strings depending on their declaration type.

REM create a single-dimension, two element number array

ARRAY myArray(2)
PRINT myArray(1), “ “, myArray(2) REM prints “0 0”

Global Variables may also be used in Basic 5000. Variables created and used within programs,

by default, are local only to that program. To create and use Global Variables, the GLOBAL

keyword may be specified before a variable’s name. The value of the global variable will be

preserved between Basic programs and can be called and updated by any other Basic program.

REM Global_var records how many times the Basic program has been called

GLOBAL Global_var

Global_var = Global_var + 1 REM adds one to our global variable

Variables, Strings and Arrays