Loop While

From UBot Studio
(Difference between revisions)
Jump to: navigation, search
Line 1: Line 1:
 
This command is a [[Flow Commands|Flow Command]]. This command runs the contained commands as long as a condition returns true.  You  
 
This command is a [[Flow Commands|Flow Command]]. This command runs the contained commands as long as a condition returns true.  You  
 
can create any condition necessary to your processes. For example, you could specify that as long as a certain element $exists on a page execute the commands in the loop.  Or using the  
 
can create any condition necessary to your processes. For example, you could specify that as long as a certain element $exists on a page execute the commands in the loop.  Or using the  
comparison qualifier, you could say, as long as the variable #number is less than 15 (<15), execute the commands in the loop. The command can be used with any [[Qualifier Commands|qualifier command]]
+
comparison qualifier, you could say, as long as the variable #number is less than 15 (<15), execute the commands in the loop. The command can be used with any [[Qualifier Functions|qualifier function]]
  
 
== Example ==
 
== Example ==

Revision as of 16:26, 12 April 2013

This command is a Flow Command. This command runs the contained commands as long as a condition returns true. You can create any condition necessary to your processes. For example, you could specify that as long as a certain element $exists on a page execute the commands in the loop. Or using the comparison qualifier, you could say, as long as the variable #number is less than 15 (<15), execute the commands in the loop. The command can be used with any qualifier function

Example

set(#number, 0, "Global")
loop while($comparison(#number, "=", 0)) {
    increment(#number)
    add item to list(%my numbers, $account data("Username"), "Delete", "Global")
}

The above script will only run if the variable #number is set to 0. If the variable is set to 0, the loop will run the increment command and the add item to list command, which will add a username to the list. It will not add anymore usernames after the variable has incremented past 0.

File:Loopwhile.png

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox