beautypg.com

Sqr (number), Sqrt (number), Step – Xylem System 5000 BASIC Manual User Manual

Page 47: Str$ (number, string)

background image

Basic Commands and Functions

The array will be automatically sized (larger or smaller) based on the number of strings that are

produced by the split. The number of strings produced will also be returned by the function.

var$ = “Analog1,Analog2,Analog3-Analog2,-Analog4”

ARRAY arr$(1)

result = SPLIT(var$, arr$(), “,-”) REM split on commas or dashes

FOR i = 1 TO result REM result = 6

REM prints “1:Analog1 2:Analog2 3:Analog3 4:Analog2 5: 6:Analog4”

PRINT i, “:”, arr$(i), “ “;

NEXT i

45

Returns the squared value of the given number. The caret (“^”) may also be used to raise a number

to a power, such as 2.

var = SQR(5) REM stores 25 in the var variable

PRINT 4^2

REM prints “16”

SQR (number)

Returns the square root value of the given number. The caret (“^”) may also be used to raise a
number to a power, such as 1/2.

var = SQRT(25)

REM stores 5 in the var variable

PRINT 16^(1/2)

REM prints “4”

SQRT (number)

Specifies an optional increment in a FOR loop. Positive or negative numbers may be used.

FOR a = 10 TO 1 STEP -2

PRINT “ “, a; REM prints “ 10 8 6 4 2”

NEXT a

STEP

Returns a string for the given number. An optional second parameter string may be specified to

declare the format to be used. Formats are specified using the hash character (“#”). If not enough

hashes are specified, the format will be returned.

var$ = STR$(18.265, “##.####”)

REM stores “18.2650” in var$

var$ = STR$(18.265, “#######”)

REM stores “ 18”

PRINT STR$(18.265) REM prints “18.265”

PRINT STR$(18.265, “#.#####”)

REM prints “#.#####”

STR$ (number, string)