How to Implement a While Loop
AnsweredIn my model, I need to implement a pulsing event which occurs on regular basis while a given condition is true.
I have used the following, but the pulse only happens once, instead of several times. This is strange because the condition remains true, so I would expect my pulse to just keep on pulsing.
if ("Cash Reserves" < 10000)
then
pulse(
("Amount of Assessment",
start="time",
interval="Frequency of Assessment"
)
else
0
Does anyone know what I'm doing wrong?
0
-
Found the problem...
I was using "time" rather than "start_time"
0 -
Glad you've found the issue! Note that your formula above seemed to have a few syntax errors, maybe just from putting in here, but here's a standalone example of using a pulse inside a conditional in case it's helpful for others. We'll look at adding more examples into the functions and syntax documentation.
if "time" > 10 and "time" < 30
then pulse(10, "start_time", 2)
else 00
Please sign in to leave a comment.
Comments
2 comments