Remote-processing BASIC for the CX-10 Modbus Uživatelský manuál Strana 25

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 84
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 24
BASIC PROGRAMMING GUIDE
2-16
DO-WHILE
Syntax: DO
{program statements}
WHILE {relational
expr
}
Function: Executes {program statements} while {relational
expr
} is true.
Mode: Run
Use: 100 CLEAR TICK(0) : DO : PRINT TICK(0) : WHILE TICK(0)<10
DESCRIPTION
The {program statements} between DO and WHILE are executed once, regardless of the {relational
expr
}
result. At WHILE 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 24
1 2 ... 20 21 22 23 24 25 26 27 28 29 30 ... 83 84

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

Žádné komentáře