Breaking out of a loop
Question ID: 314
1
0

I have a test with a repeater set to 100 iterations.  Let’s say it is going to try 100 times to buy a ticket.  Once it succeeds I want it to break out of the loop and do some other things.  Is that possible?

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on June 1, 2023 12:38 pm
8 views
0
On the same topic. There is probably a need for both "break" and "continue" while in a loop.
( at June 2, 2023 10:29 am)
0
In the context of the way loops are done in Alchemy by repeating a function, continue is really "return". Return just returns the function back to the caller which was the Repeater and the next iteration would be executed. Break on the other hand stops the repeater.
( at June 2, 2023 1:27 pm)

Answers (1)

1
Private answer

Yes you can!  Have a look a the Break or Continue action.  Break will cause a Loop to stop executing where as the Continue will cause the loop to skip the rest of the steps and start again at the top of the loop.  When using Break or Continue, you can optionally pass a message in the step as well indicating why it failed.

 

You can call either of these anywhere within the target function

cm

Marked as spam
Posted by (Questions: 0, Answers: 38)
Answered on June 7, 2023 11:21 am

Welcome to Alchemy Center!
Please Log In to participate in the discussion.

X
Scroll to Top