Mioplanet Documentation Center
Resources and Help
HomeProductsMioScriptJavaScriptTechNotesPHP
   Home | MioScript | MioScript: Loops SEARCH    


  TechNotes
About MioEngine
About MioScript
Adding a Login feature
Admin Panel Configuration File: Account
Admin Panel Configuration File: Alerts
Admin Panel Configuration File: Channels
Admin Panel Configuration File: Servers
Admin Panel Configuration File: Software
Admin Panel Configuration File: Tasks
Admin Panel Installation Troubleshooting
Deploying an application remotely
Get the real size of a web page
How to create a Business Card
How to create a Desktop Alert
How to create a Desktop Ticker
How to create a Scrolling Alert Software
How to create a Scrolling Ticker
How to create a simple RSS Reader
How to debug
Installing Admin Panel on a server
LCD Monitor Chart: Screen Resolution, Size, Pitch, Display Area
Managing read marks
Measuring Elements in JavaScript
Media center remote control
Mio File Format
MioScript: Conditions
MioScript: Events
MioScript: Functions
MioScript: Loops
MioScript: Variables and Data Types
Programming MioScript
Statistics: How to track users and actions
Where to host Mioplanet Admin Panel
XML Configuration File Format

  MioScript Reference
> Statements
app...
browser...
dialog...
disk...
draw...
extern...
filename...
keyboard...
menu...
mio...
mouse...
num...
path...
pushButton...
reg...
RS232...
sci...
screen...
shortcut...
sound...
str...
system...
time...
var...
window...

  Products
All Products
MioDB
MioFactory
Mioplanet Admin Panel

TechNote
MioScript: Loops

Language: MioScript


 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