User Tools

Site Tools


modding:function:for

for

for

for

Syntax (for var from to exp) → value of last expression
Arguments var: The storage for the counter. This will increase by one at the end of the function every time it is run.
from: The number that will be the initial value
to: The last number that the variable will be run as.
expr: The expression that will be evaluated with the current value set available under the name set in `variable'
Returns Whatever the last expression returns.
Category iteration
Description Evaluates expression using variable for every value between and including the two numbers.

Example

(block (sum)
	(setq sum 0)
	(for varies 3 8 (setq sum (add varies sum))) 
	)

This returns the number 33. Return to Functions list

modding/function/for.txt · Last modified: 2014/12/27 04:40 by 127.0.0.1