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!

Add Comment
1 Answer(s)

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 🙂

Answered on November 20, 2016.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.