UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

C-2 UniBasic Commands Reference Arithmetic Operators The following table describes the arithmetic operators for UniBasic. Operator Action Example Related Function + Unary plus (same as multiplying by +1). - Unary minus (changes to the opposite sign, same as multiplying by -1). VAR = +VAR ABS VAR = -VAR NEG + Addition. X = VAR1 + VAR2 VAR = VAR + 1 - Subtraction. X = VAR1 - VAR2 VAR = VAR - 1 SADD, SUM SSUB * Multiplication. X = VAR1 * VAR2 SMUL / Division. QUANTITY = PRICE/COST SDIV ** or ^ Exponentiation. X = VAR^2 PWR :, CAT Concatenation. X = VAR1:VAR2 += Increments the value of a variable. -= Decrements the value of a variable. LINES += 1 LINES -= 1 Arithmetic Operators

Operator Action Example Related Function *= Multiplies the value to the left of the operator by the value to the right of the operator. /= Divides the value to the left of the operator by the value to the right of the operator. := Concatenates the value to the left of the operator by the value to the right of the operator. VAR1 *= VAR2 VAR1 /= VAR2 VAR1 := VAR2 Arithmetic Operators (continued) Note: You must include the REUSE function to apply arithmetic operations to all elements of a dynamic array. C-3

C-2 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

Arithmetic Operators<br />

The following table describes the arithmetic operators for <strong>UniBasic</strong>.<br />

Operator Action Example Related Function<br />

+ Unary plus (same as<br />

multiplying by +1).<br />

- Unary minus<br />

(changes to the<br />

opposite sign, same as<br />

multiplying by<br />

-1).<br />

VAR = +VAR ABS<br />

VAR = -VAR NEG<br />

+ Addition. X = VAR1 + VAR2<br />

VAR = VAR + 1<br />

- Subtraction. X = VAR1 - VAR2<br />

VAR = VAR - 1<br />

SADD, SUM<br />

SSUB<br />

* Multiplication. X = VAR1 * VAR2 SMUL<br />

/ Division. QUANTITY =<br />

PRICE/COST<br />

SDIV<br />

** or ^ Exponentiation. X = VAR^2 PWR<br />

:, CAT Concatenation. X = VAR1:VAR2<br />

+= Increments the value<br />

of a variable.<br />

-= Decrements the value<br />

of a variable.<br />

LINES += 1<br />

LINES -= 1<br />

Arithmetic Operators

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!