EasyManuals Logo

Trio Motion Coordinator MC206 User Manual

Default Icon
566 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 #178 background imageLoading...
Page #178 background image
7-6 Programming
Iteration
Trio Motion Technology
The program would set the variable
t
to a value of 1 and then go to the next
line to
PRINT
. After the print, the
NEXT
command would return the program to
the
FOR
command and increment the value of T to make it 2. When the
PRINT
command is used again, the value of T has changed and a new value is printed.
This continues until T has gone from 1 through to 5, then the loop ends and
the program is permitted to continue. The next command after the
NEXT
statement prints "Done" to the screen slowing the program has left the loop.
You can also next loops to create a loop within a loop, as the following
example shows:
FOR a=1 TO 5
PRINT "MAIN A=";a
FOR a=1 TO 10
PRINT "LITTLE B=";a
NEXT a
NEXT a
The
FOR..NEXT
statement loops the main A variable from 1 to 5, but for every
loop of A the
FOR..NEXT
statement inside the first loop must also loop its
variable B from 1 to 10. This is known as a nested loop as the loop in the
middle is nested inside an outer loop..
Such loops are especially useful for working on array data by using the
variables that increment as position indexes for the arrays. As an example, we
could list all our lottery numbers using the following example:
FOR y=1 TO 12
FOR x=1 to 12
MOVEABS(x,y)
NEXT x
NEXT y

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Trio Motion Coordinator MC206 and is the answer not in the manual?

Trio Motion Coordinator MC206 Specifications

General IconGeneral
BrandTrio
ModelMotion Coordinator MC206
CategoryController
LanguageEnglish

Related product manuals