AutoCAD developers how can I break out of a loop?
I’m writing a script that’s using a while loop, but I want to be able to break from the loop in certain conditions.
Unfortunately I can’t find a simple “break” command like you’d see in Java. Is there a simple way of breaking out without brute forcing all my conditions to exit?
Thanks in advance code ninjas!
Hi there,
You can set an escape switch with a variable like this:
(while (= switch 0) (do stuff)... on condition (setq switch 1))
Hope this helps 🙂