PRODUCT |

|

|
|
|

|
|
|
|
|
|
|
|
|
FAQ |
|
|

|
|
|
|
|
|
|
|
|
|
LEARN SCRIPTING |
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SAMPLE SCRIPTS |
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HELP / DOCUMENTATION |
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
Help Page - while
( Some help pages may not display correctly in html because those help pages may have sample code in them, part of which may be mis-interpreted as html tags.
All help pages, including this help page, are available in biterScripting with the help command. )
|
|
|
Command
while
Purpose
Creates and executes a command or a command block repeatedly.
Aliases
while
Syntax
while <condition>
<line>
Options
None.
Arguments
<condition> An expression resulting in a bool constant.
<line> The line to execute repeatedly as long as <condition> is true.
<line> can have one command, or a block of commands enclosed within do...done.
Stream Input
Ignored.
Stream Output
None.
Stream Error
Any errors are listed here.
Description
while is a programming construct that allows the user to repeatedly execute one commands or
a block of commands.
<condition> is evaluated at runtime, and not when the command is first entered.
(Since the while, and any other command, can be inside another programming construct, function, script etc.,
its run-time value may not be necessarily the same as its parse-time value.)
Nesting of all programming constructs (while, if...else...endif, do...done, function, etc.) is allowed.
There is no limit on how many levels of nesting can be done.
<condition> can contain AND, OR, and NOT bool operators. It is recommended that you use parentheses when
using these operators. There is no limit on how many, or how many levels of, parentheses can be used.
Restrictions
Stream redirection is not allowed on the while command. However, command within <line>, and within
do-done command-block used in place of <line>, can contain their own stream redirection.
Valid Examples
var int i
while ($i<50)
do
set $i = $i+1
echo ($i*$i)
done
Will print squares of integers between 1 and 50.
Invalid Examples
var int i
while ($i)
do
set $i = $i+1
echo ($i*$i)
done
Will produce error. The expression ($i) does not evaluate to a bool value, and thus, it is not a valid
condition.
var int i
while ($i<50)
echo ($i*$i)
set $i = $i+1
The above will go into an infinite loop since the only command executed repeatedly is the echo command. $i
never gets incremented. This could happen if one forgets to put a do...done block after a while command.
See Also
break
do
if
|
|
|
© 2008-2010, biterScripting.com. All rights reserved.
biterScripting, biterScript, biterBrowser, biterScripting.com, FVA (Forward Variable Assignment) are trademarks of biterScripting.com. Is it biterScripting-compatible ? is a service mark of biterScripting.com.
Explorer, Unix, Windows are trademarks, service marks or other forms of intellectual property of their respective owners.
|
|