FOR (TRY, WHILE)
Do next command or block repeatedly.
Syntax
try [count]
command
try [count]
{
command
...
command
}
Parameters
count
- Decimal number from 2 to 100, tells how many times next command or block will be retried.
Example
sleeps 200 ; Set sleeps = 200 ms
10 ; Set 'output state' = 100000000000.....
cycle: ; Define Label
; All of these bocks give the same results:
; =================================
; Optimal block
try 2 ; Do next block for 2 times
{ ; Define start of block (by brace)
lsl 4 ; Do 'shift left' for 4 times
lsr 4 ; Do 'shift right' for 4 times
} ; Define end of block (by brace)
; =================================
; This block have same effect
try 2 ; Do next block for 2 times
{
try 4 ; Do next comand for 4 times
lsl ; Do 'shift left'
try 4 ; Do next comand for 4 times
lsr ; Do 'shift right'
}
; =================================
; Cascading example
try 2 ; Do next block for 2 times
{
try 2 ; Do next block for 2 times
{
lsl
lsl
}
try 2 ; Do next block for 2 times
{
lsr 2
}
}
; =================================
; Cascading without braces
try 2 ; Do next command for 2 times
try 2 ; Do next command for 2 times
lsl ; The command
try 2 ; Do next command for 2 times
try 2 ; Do next command for 2 times
lsr ; The command
try 4 ; Do next command for 4 times
lsl ; The command
try 4 ; Do next command for 4 times
lsr ; The command
goto cycle