Remote-processing BASIC 52 Uživatelský manuál Strana 52

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 163
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 51
RPBASIC-52 PROGRAMMING GUIDE
2-33
DO-UNTIL
Syntax: DO
{program statements}
UNTIL relational expr
Where: relational expr is any logical evaluation such as =, <, >, etc.
Function: Executes a number of program statements a relational expression is true.
Mode: Run
Use: 100 A=0 : DO : A=A+1 : PRINT A : UNTIL A=4 : PRINT "Done"
Cards: All
DESCRIPTION
This statement always executes at least once. DO-UNTIL loops may be nested. This loop may be exited
without meeting relational expr by executing a CLE AR or C LEAR S statem ent.
This statement always executes to UNTIL once. When relational expr is evaluated and if it is false, program
flow branches bac k to DO. If true , program resume s at the next sta teme nt after UN TIL.
When there are no {program statem ents} between DO and UNTIL, and {relational expr} is false, the "loop"
will repeat forever, or until a <ctrl-c> is typed at the console.
DO-UNTIL and DO-WH ILE loops can be nested.
RELATED
DO-WHILE, FOR-TO-NEXT-STEP
ERROR
BAD SYNTAX When relational expr is omitted
EXAMPLE
The following program stays in a DO-UNTIL loop until a line has changed.
10 ON LINE 0,0,500
20 DO
30 UNTIL C=1
40 PRINT "Line 0 changed. Is now a",line(0)
50 C=0
60 GOTO 20
500 C=1
510 RETURN
>run
Line 0 changed. Is now a 0
Line 0 changed. Is now a 1
Line 0 changed. Is now a 0
Zobrazit stránku 51
1 2 ... 47 48 49 50 51 52 53 54 55 56 57 ... 162 163

Komentáře k této Příručce

Žádné komentáře