Message 1 of 17
Not applicable
11-12-2019
02:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello Fellows,
Is there a possibility to create a nested loop with Visual Lisp?
Let's say I want to count to 3 with while loop and for every digit I want to count again to 3.
So I assume I will get such result:
" 1 1 2 3
2 1 2 3
3 1 2 3 "
But in fact when I build my while loop:
(defun nl () (setq i 0 x 0) (while (< i 3) (while (< x 3) (setq x (+ x 1)) (princ (strcat " " (itoa x) " ")) ) (setq i (+ i 1)) (princ (strcat " " (itoa i) " ")) ) (princ) )
I get this result:
" 1 2 3 1 2 3 "
What do I do wrong?
Solved! Go to Solution.
|