User Tools

Site Tools


modding:function:loop

loop

loop

loop

Syntax (loop condition exp) → value of last expression
Arguments condition: The function keeps on running as long as the condition is not Nil.
exp: The expression you want to evaluate as long as the condition is not Nil.
Returns Whatever the last evaluated expression returns.
Category iteration
Description Evaluates the expression over and over until the condition is Nil. The expression will never be evaluated if the condition starts as Nil.

Example

(block (number)
 
	(setq number 1)
 
	(loop (ls number 5)
 
		(block Nil
 
			(setq number (add 1 number))
 
			(dbgOutput number)
 
			"yay"
 
			)
 
		)
 
	)

Displays on the debug console.

2

3

4

5

Returns the string yay.

Return to Functions list

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