(loop conditional function)
A loop works like this.
First you check the conditional if false go to the code after the loop.
If true run the function.
Go to the conditional.
Now that we know how the loop works then lets make the other kind of loop.
(enum mylist variable function)
Not too hard just have a extra variable. index
Code: Select all
(setq index 0)
(setq listSize (count myList))
(loop (ls index listSize)
(setq variable (item myList index))
;put the function here
(setq index (add index 1))
)
Nearly the same as enum but has an extra condition.
Code: Select all
(setq index 0)
(setq listSize (count myList))
(loop (and (ls index listSize) condition)
(setq variable (item myList index))
;put the function here
(setq index (add index 1))
)
For is simpler than the others.
Code: Select all
(setq index startIndex)
(loop (leq index endIndex)
(setq variable index)
;put the function here
(setq index (add index 1))
)
Code: Select all
(setq runOnce True)
(loop (or runOnce conditional)
;put the function here
(setq runOnce nil)
)