How do I use WHILE DO Statement?

Repeats logic or logic block continuously while a condition remains true.


WHILE v_Var1 > 3 DO TIME(10 min)
WHILE v_Var1 < a_Attr3 AND Var2 >= 5 DO


Boolean expression The condition that must be satisfied to continue processing the entity or resource. One side of the Boolean expression must contain a variable that can change due to some other event in the model.


The following example uses the WHILE…DO loop to track the day of the week. v_Var1 is a variable that is set to zero at the beginning of the simulation and remains constant, so the loop will continue for the length of the simulation. v_Day_of_Week is a variable that changes every 24 hours and is reset to one on the eight day.

While v_Var1 = 0 DO

INC v_Day_of_Week
IF v_Day_of_Week = 8 THEN v_Day_of_Week = 1
TIME(24 Hr)


Logic Statements:

Was this article helpful?

Related Articles