LassoScript Utility
Basics Browse Detail

[While] ... [/While]

Tag Link [While] ... Category Conditional
Type Container Source Available No
Support Preferred Version 2.5
Change Unchanged Data Source Any
Output Type None Security None
Implementation Internal Sets Lasso 8.5, Lasso 8.0, Lasso 7.0, Lasso 6.0, Lasso 5.0, Lasso 3.x, Lasso 2.5


[While] ... [/While] repeats the contents of the container tag until the condition specified in the opening tag returns False.


[WhileConditional Expression]


Required Parameters
Conditional Expression The conditional expression which is executed on each repetition of the contents of the container tag.


To repeat a calculation until the desired result is achieved:

Use the [While] ... [/While] tags with an appropriate conditional expression. The following example calculates the Fibonacci numbers until one greater than 1000 is returned.

[Var: 'Fibonacci_One'=1]
[Var: 'Fibonacci_Two'=1]
[While: (Var: 'Fibonacci_One')<1000]
  [Var: 'Fibonacci_New'=(Var:'Fibonacci_One') + (Var:'Fibonacci_Two')]
  [Var: 'Fibonacci_Two'=(Var:'Fibonacci_One')]
  [Var: 'Fibonacci_One'=(Var: 'Fibonacci_New')]