[[modding:function:enum]]
=== enum ===
[[modding:function:enum]]
^ Syntax | (enum list itemVar exp) -> value |
^ Arguments | list: A list of elements you want to walk through. |
^ | itemVar: Name of variable that will be used to hold the current element you are at in the enum. Does not need to be defined beforehand. |
^ | exp: The expression you want to evaluate for each element in the list. The element will be available inside the expression under the name you used in `itemVar'. |
^ Returns | value: Whatever the last function run in this returns. |
^ Category | [[iteration functions|iteration]], [[list functions|list]] |
^ Description | A function allowing you to run an expression using the variable to store the element you are at for every element in a list. |
=== Example ===
(enum '(a b c d) theElement
(dbgOutput theElement)
)
Will display on the debug console.
a
b
c
d
True
Return to [[:Functions]] list