Closed hutonahill closed 9 months ago
A while loop already exists (REPEAT) but it is limited to fixed number of iterations or iterating all items in a list. I think what would be really useful would be a while loop with a customizable exit condition: WHILE x < y, where it checks the values at each iteration, allowing you to break a loop early if needed. Alternatively a BREAK command to exit an existing REPEAT loop would be just as useful.
REPEAT is a lot closer to a for loop than a while loop. Being able to loop until a condition has been met is what I am looking for. a BREAK function would technically work, but I can just see my professors lecturing me to dust if they heard I was using break.
Let the professors lecture away. If you need to write code in language X, you are always limited to the available commands in that language. You can achieve what you want in Shortcuts using REPEAT and a nested shortcut structure. Shortcut A calls shortcut B. Shortcut B contains the loop, with an IF action inside the loop. Shortcut B can thus break the loop and return a value to shortcut A when the condition is met.
I unfortunately don't think this is possible.
I encourage you to send feedback to Apple about making an action for this: https://feedbackassistant.apple.com
Link doesn't work.
Description
The title speaks for itself. I don't even know if this is possible, but it would be amazing.