Difference between revisions of "Command:While"

From Lavish Software Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== Syntax ==
 
== Syntax ==
 
{{CMD-DR|While|Intermediate|Intermediate|Beginner|Intermediate}}
 
{{CMD-DR|While|Intermediate|Intermediate|Beginner|Intermediate}}
 +
While <condition>
  
 
== Description ==
 
== Description ==
 +
Used in conjunction with [[Command:Do|Do]] to create a While loop.  "While" marks the end of the loop, whereas "Do" marks the beginning.  When this command is executed, the condition is checked.  If the condition is met then execution continues from [[Command:Do|Do]], otherwise continuing past While.
  
 
== Examples ==
 
== Examples ==
 +
Declare Count int 1
 +
Do
 +
{
 +
  Echo ${Count}
 +
  VarCalc Count ${Count}+1
 +
}
 +
While "${Count}<10"
  
 
== See Also ==
 
== See Also ==
 +
*[[Command:Break|Break]]
 +
*[[Command:Continue|Continue]]
 +
*[[Command:Do|Do]]
 
*[[LavishScript:Commands|Commands]]
 
*[[LavishScript:Commands|Commands]]
 
{{Command-Stub}}
 
{{Command-Stub}}

Revision as of 06:05, 2 April 2005

Syntax

Command Difficulty Rating
While
Usage Intermediate
Level of Understanding Intermediate
Computer Savvy Beginner
Logic Intermediate

While <condition>

Description

Used in conjunction with Do to create a While loop. "While" marks the end of the loop, whereas "Do" marks the beginning. When this command is executed, the condition is checked. If the condition is met then execution continues from Do, otherwise continuing past While.

Examples

Declare Count int 1
Do
{
  Echo ${Count}
  VarCalc Count ${Count}+1
}
While "${Count}<10"

See Also