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

  • 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 52
RPBASIC-52 PROGRAMMING GUIDE
2-34
DO-WHILE
Syntax: DO
{program statements}
WHILE {relational expr}
Function: Executes {program statements} w hile {relational expr} is true.
Mode: Run
Use: 100 CLEAR TICK(0) : DO : PRINT TICK(0) : WHILE TICK(0)<10
Cards: All
DESCRIPTION
The {program statem ents} between DO and WHILE are executed once, regardless of the {relational expr}
result. At WH ILE the {relational expr} is evaluated. If true, all {program statements} are executed again,
and the test is repeated. If false, execution continues at the program statement after WHILE. DO-WHILE
and DO-UNTIL loops can be nested.
RELATED
DO-UNTIL, FOR-TO-STEP-NEXT
EXAMPLE
The following program stays in a DO-UNTIL loop until a line has changed.
10 ON LINE 0,0,500
20 DO
30 WHILE C=0
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 52
1 2 ... 48 49 50 51 52 53 54 55 56 57 58 ... 162 163

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

Žádné komentáře