|
|
|
|
TechNotes
MioScript Reference
Products
|
|
| | Loops gives the ability to process blocks of code repeatedly.
Statements placed inside loops are executed a set number of times, or even infinitely.
|
for Loop| |
The for loop repeats a block of code and increment or decrement a variable while a condition is not true.
for(&ptr, 0, 3)
alert(&ptr)
for.next
|
For more information: for, for.next, for.exit
|
while Loop| |
The while loop repeats a block of code while a condition is not true.
No variable is incremented or decremented.
The following example is equivalent to the previous one, but with the use of the while loop instead of the for loop.
&ptr = 0
while(&ptr < 3)
alert(&ptr)
var.inc(ptr, 1)
while.end
|
For more information: while, while.end, while.exit
|
Event Driven Loop| |
Events can be used to create loops.
Contrary to the while or for loops, an event driven loop will not stop the process of the application.
The application can react to events while performing the loop in background.
In the example below, the block of code between event.loop and event.end is interpreted one time per millisecond indefinitively.
As an event is used, the application continues to react to the user interactions.
event.loop
...
doEvent.loop()
event.end
|
More info and code sample: MioScript: Events.
See also: doEvent.eventName, event.eventName, event.end
|
|
|
|