UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
1-369 UniBasic Commands Reference A single-line statement that includes the INPUT command as a part of the THEN clause might not produce the results you expect. For example, the following statements produce no output: IF X = 1 THEN INPUT TEST ELSE PRINT "X NE 1" To correct this problem, enter each clause of the statement on a separate line, or use the IN() function to obtain input from theterminal or input queue. With null value handling turned on, a test on expr that is the null value returns false. For an overview of how the null value affects UniBasic, see Developing UniBasic Applications. Tip: You can nest IF/THEN/ELSE statements, but a CASE statement might be more efficient. Examples In the following example, the program statement tests if the variable SUPPLY is less than the variable DEMAND. If the comparison is true, program control is transferred to the statement labeled REORDER. IF SUPPLY < DEMAND THEN GOSUB REORDER In the next example, the program segment compares INCOME to TARGET. UniData executes the first branch if the comparison is true, or executes the second group of statements if the comparison is false. IF INCOME < TARGET THEN PRINT "Income less than target figure." END ELSE PRINT "Income equal to or greater than target!" END Related Commands UniBasic CASE, LOOP/REPEAT, NULL
IN Syntax IN( ) Description The UniBasic IN function captures raw data from an input queue or from a terminal. Tip: IN can capture function, arrow, and other special keys from the keyboard. Example In the following example, the program segment assigns the value y to ANSWER: DATA y ANSWER = IN() Related Commands UniBasic DATA, INPUT, INPUT @, INPUTTRAP, SYSTEM IN 1-370
- Page 358 and 359: Examples In the following example,
- Page 360 and 361: Parameter Description The replace.n
- Page 362 and 363: This next example compiles and runs
- Page 364 and 365: Related Command UniBasic GTS 1-326
- Page 366 and 367: HASH Syntax HASH(rec.key,modulo,typ
- Page 368 and 369: Parameters The following table desc
- Page 370 and 371: HUSH Syntax HUSH {ON | OFF | expr}
- Page 372 and 373: ICONV Syntax ICONV(expr,conv.code.e
- Page 374 and 375: STATUS Function Return Values After
- Page 376 and 377: 1-337 UniBasic Commands Reference
- Page 378 and 379: The following table describes vario
- Page 380 and 381: Related Command UniBasic OCONV Grou
- Page 382 and 383: Example In the following example, t
- Page 384 and 385: Parameters Description Example You
- Page 386 and 387: Parameter Description Examples In t
- Page 388 and 389: Parameter Description Example In th
- Page 390 and 391: ICONV Packed Decimal (MP1) Syntax I
- Page 392 and 393: Parameter Description Example In th
- Page 394 and 395: Example The following table describ
- Page 396 and 397: The following table lists conversio
- Page 398 and 399: ICONV Pattern Match (P) Syntax ICON
- Page 400 and 401: Example In the following example, t
- Page 402 and 403: ICONV Text Extraction (T) Syntax IC
- Page 404 and 405: ICONV File Translation (Tfile) Synt
- Page 406 and 407: STATUS Function Return Values After
- Page 410 and 411: INDEX Syntax INDEX(str.expr1,str.ex
- Page 412 and 413: INDICES Syntax INDICES(file.var[, i
- Page 414 and 415: initSecureServerSocket function Syn
- Page 416 and 417: initServerSocket Syntax initServerS
- Page 418 and 419: INMAT Syntax INMAT( ) INMAT(array.n
- Page 420 and 421: Related Commands UniBasic DIM, MAT,
- Page 422 and 423: Warning: Processing differs when yo
- Page 424 and 425: In the next example, the INPUT stat
- Page 426 and 427: Parameter Description 1-387 UniBasi
- Page 428 and 429: Related Commands UniBasic CLEARINPU
- Page 430 and 431: INPUTERR Syntax INPUTERR error.expr
- Page 432 and 433: INPUTIF Syntax INPUTIF var [THEN st
- Page 434 and 435: INPUTTRAP Syntax INPUTTRAP string.e
- Page 436 and 437: INS Syntax INS expr BEFORE dyn.arra
- Page 438 and 439: INSERT Syntax INSERT(dyn.array.expr
- Page 440 and 441: INT Syntax INT(num.expr) Descriptio
- Page 442 and 443: ISNV Syntax ISNV(expr) Description
- Page 444 and 445: ISNVS Syntax ISNVS(dynamic.array) D
- Page 446 and 447: ITYPE Syntax ITYPE(itype.expr) Desc
- Page 448 and 449: LE Syntax expr1 LE expr2 Synonyms #
- Page 450 and 451: LEN Syntax LEN(str.expr) Descriptio
- Page 452 and 453: LENS Syntax LENS(dyn.array) Descrip
- Page 454 and 455: LISTUSER Syntax LISTUSER() Descript
- Page 456 and 457: LN Syntax LN(num.expr) Description
1-369 <strong>UniBasic</strong> <strong>Commands</strong> <strong>Reference</strong><br />
A single-line statement that includes the INPUT command as a part of the<br />
THEN clause might not produce the results you expect. For example, the<br />
following statements produce no output:<br />
IF X = 1 THEN INPUT TEST ELSE PRINT "X NE 1"<br />
To correct this problem, enter each clause of the statement on a separate line,<br />
or use the IN() function to obtain input from theterminal or input queue.<br />
With null value handling turned on, a test on expr that is the null value returns false.<br />
For an overview of how the null value affects <strong>UniBasic</strong>, see Developing <strong>UniBasic</strong><br />
Applications.<br />
Tip: You can nest IF/THEN/ELSE statements, but a CASE statement might be more<br />
efficient.<br />
Examples<br />
In the following example, the program statement tests if the variable SUPPLY is less<br />
than the variable DEMAND. If the comparison is true, program control is transferred<br />
to the statement labeled REORDER.<br />
IF SUPPLY < DEMAND THEN GOSUB REORDER<br />
In the next example, the program segment compares INCOME to TARGET. UniData<br />
executes the first branch if the comparison is true, or executes the second group of<br />
statements if the comparison is false.<br />
IF INCOME < TARGET THEN<br />
PRINT "Income less than target figure."<br />
END ELSE<br />
PRINT "Income equal to or greater than target!"<br />
END<br />
Related <strong>Commands</strong><br />
<strong>UniBasic</strong><br />
CASE, LOOP/REPEAT, NULL