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

In the next example, the program segment transfers program control to either “CHARGE:” or “CHECK:” based on the value of the variable VAL. If VAL is not 1 or 2, the program executes the statements after the CASE 1 clause. 1-127 UniBasic Commands Reference PRINT "Option number?" ; INPUT VAL BEGIN CASE CASE VAL = 1 GOSUB CHARGE: CASE VAL = 2 GOSUB CHECK: CASE 1 PRINT "Answer 1 or 2 only" END CASE In the following example, the statement is invalid because the evaluation expression appears on the BEGIN CASE line: BEGIN CASE VAR 1 In the next example, the statement is invalid because BEGIN CASE must appear before the first CASE statement: CASE VAL Related Commands UniBasic IF/THEN/ELSE, LOOP/REPEAT

CAT Syntax expr1 CAT expr2 Synonym : Description The UniBasic CAT arithmetic operator concatenates expr1 to expr2. Examples In the following example, the program segment concatenates A to B, and then prints 123456: A = "123" B = "456" C = A CAT B PRINT C The following program segment compiles and runs only with null value handling on. The program concatenates two strings, one ending with the null value, and another beginning with ‘123.’ This produces the string @AM@NULL123@AM456. The called subroutine, print.setup, converts UniData delimiters and the null value to printable characters. (This subroutine is printed in the entry for “CHANGE” on page 133.) PRT.STG = '' Z=123:@AM:456 Y=@AM:@NULL STG = Y CAT Z CALL print.setup(STG,PRT.STG) PRINT PRT.STG CAT 1-128

In the next example, the program segment transfers program control to either<br />

“CHARGE:” or “CHECK:” based on the value of the variable VAL. If VAL is not 1<br />

or 2, the program executes the statements after the CASE 1 clause.<br />

1-127 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />

PRINT "Option number?" ; INPUT VAL<br />

BEGIN CASE<br />

CASE VAL = 1<br />

GOSUB CHARGE:<br />

CASE VAL = 2<br />

GOSUB CHECK:<br />

CASE 1<br />

PRINT "Answer 1 or 2 only"<br />

END CASE<br />

In the following example, the statement is invalid because the evaluation expression<br />

appears on the BEGIN CASE line:<br />

BEGIN CASE VAR 1<br />

In the next example, the statement is invalid because BEGIN CASE must appear<br />

before the first CASE statement:<br />

CASE VAL<br />

Related <strong>Commands</strong><br />

<strong>UniBasic</strong><br />

IF/THEN/ELSE, LOOP/REPEAT

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

Saved successfully!

Ooh no, something went wrong!