UniBasic Commands Reference - Rocket Software
UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software
Examples The following example is taken from the sample program in Appendix A, “Sample Program,” in Developing UniBasic Applications. This subroutine loops until the user enters a valid order number, or Q (the prompt for order number is already displayed on the screen). 1-430 UniBasic Commands Reference GET_ORDER_NUMBER: * Have the user enter a valid key to a record in the ORDERS file. LOOP DISPLAY @(15,6): INPUT ORDER_NUMBER ORDER_NUMBER = OCONV(ORDER_NUMBER,"MCU") IF NUM(ORDER_NUMBER) OR ORDER_NUMBER[1,1] = "Q" THEN VALID_ORDER_NUMBER = 1 END ELSE VALID_ORDER_NUMBER = 0 MESSAGE = "Order # must be a Number, or the letter 'Q'" CALL DISPLAY_MESSAGE(MESSAGE) END UNTIL VALID_ORDER_NUMBER REPEAT In the next example, the program segment prints and increments POS until it reaches the value of 10: POS=0 LOOP WHILE POS < 10 DO PRINT POS POS +=1 REPEAT In the next example, the program segment prints “Counting” and then increments C. It then evaluates C to see if it is less than eight, and if so, executes the second statement. On the eighth iteration, the program executes the top statement and the loop stops because the condition (C > 8) is met. The program continues execution at the statement following REPEAT. The program does not execute the second statement on the final iteration. C = 0 PRINT "Counting:" LOOP C = C+1 UNTIL C > 8 DO PRINT "C = ":C REPEAT
The result of this program: Counting: C = 1 C = 2 C = 3 C = 4 C = 5 C = 6 C = 7 C = 8 Related Commands UniBasic CASE, CONTINUE, FOR/NEXT LOOP/REPEAT 1-431
- 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
- Page 458 and 459: The following table describes the s
- Page 460 and 461: Parameters The following table desc
- Page 462 and 463: LOCATE in BASICTYPEs U, P, and M Th
- Page 464 and 465: However, in the following array, th
- Page 466 and 467: Parameters The following table desc
- Page 468 and 469: LOOP/REPEAT Syntax LOOP [statements
- Page 472 and 473: LOWER Syntax LOWER(dyn.array.expr)
- Page 474 and 475: Related Command UniBasic LTS 1-434
- Page 476 and 477: MAT Syntax MAT dim.array = expr MAT
- Page 478 and 479: the values assigned to FEE1 would b
- Page 480 and 481: Parameter Description Examples In t
- Page 482 and 483: MATCH Syntax var MATCH "[~] len [X,
- Page 484 and 485: MATCHFIELD Syntax MATCHFIELD(str.ex
- Page 486 and 487: MATPARSE Syntax MATPARSE dim.array
- Page 488 and 489: The preceding program segment produ
- Page 490 and 491: Parameter Description INMAT Functio
- Page 492 and 493: MATREADL Syntax MATREADL dim.array
- Page 494 and 495: Example In the following example, t
- Page 496 and 497: Parameters The following table desc
- Page 498 and 499: Related Commands UniBasic DIM, INMA
- Page 500 and 501: Parameter Description STATUS Functi
- Page 502 and 503: MATWRITEU Syntax MATWRITEU dim.arra
- Page 504 and 505: MAXIMUM Syntax MAXIMUM(dyn.array.va
- Page 506 and 507: MDPERFORM Syntax MDPERFORM str.expr
- Page 508 and 509: Parameter Description Examples In t
- Page 510 and 511: MINIMUM Syntax MINIMUM(dyn.array.va
- Page 512 and 513: NE Syntax expr1 NE expr2 Synonyms #
- Page 514 and 515: NEG Syntax NEG(expr) Description Th
- Page 516 and 517: NFAUSER Syntax NFAUSER(“username
- Page 518 and 519: DCOUNT INDEX LEN SEQ SWAP 1-480
The result of this program:<br />
Counting:<br />
C = 1<br />
C = 2<br />
C = 3<br />
C = 4<br />
C = 5<br />
C = 6<br />
C = 7<br />
C = 8<br />
Related <strong>Commands</strong><br />
<strong>UniBasic</strong><br />
CASE, CONTINUE, FOR/NEXT<br />
LOOP/REPEAT 1-431