EasyManuals Logo
Home>CipherLab>PDA>8 Series

CipherLab 8 Series User Manual

CipherLab 8 Series
263 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #49 background imageLoading...
Page #49 background image
37
Chapter 4 BASIC Commands
4.3 COMMANDS FOR LOOPING STRUCTURES
Looping structures repeat a block of statements, either for a specified number of times or
until a certain condition is matched. In CipherLab BASIC, two kinds of looping structures,
FOR…NEXT and WHILEWEND can be used. The command EXIT can be used as an
alternative to exit from both FOR…NEXT and WHILEWEND loops.
Both FORNEXT and WHILEWEND statements can be nested up to 10 levels.
EXIT
Purpose To provide an alternative exit for looping structures, such as FORNE
XT and
WHILEWEND statements.
Syntax EXIT
Remarks EXIT can appear anywhere within the loop statement.
Example
DataCount% = TRANSACTION_COUNT
FOR Counter% = 1 TO DataCount%
Data$ = GET_TRANSACTION_DATA$(Counter%)
HostCommand$ = READ_COM$(1)
IF HostCommand$ = “STOP” THEN EXIT
WRITE_COM(1, Data$)
NEXT
FOR NEXT
Purpose
To repeat the execution of a block of statements for a specified number of
times.
Syntax FOR N% = startvalue TO endvalue [STEP step]
[Statement Block]
NEXT [N%]
Remarks N%is an integer variable to be used as a loop counter.
startvalue
is a numeric expression which is the initial value for the loop
counter.
endvalue
is a numeric expression which is the final value for the loop counter.
stepis a numeric expressi
on to be used as an increment/decrement of the
loop counter The stepis 1 by default.
If the loop counter ever reaches or beyond the endvalue, the program
execution continues to the statement following the NEXT statement. The
Statement block will be executed again otherwise.
Example
DataCount% = TRANSACTION_COUNT
FOR Counter% = 1 TO DataCount%
Data$ = GET_TRANSACTION_DATA$(Counter%)
WRITE_COM(1, Data$)
NEXT

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the CipherLab 8 Series and is the answer not in the manual?

CipherLab 8 Series Specifications

General IconGeneral
BrandCipherLab
Model8 Series
CategoryPDA
LanguageEnglish

Related product manuals