repeat

AutoCad AutoLISP Functions

 
repeat
 
 
 

Evaluates each expression a specified number of times, and returns the value of the last expression

(repeat int [expr...])

Arguments

int

An integer. Must be a positive number.

expr

One or more atoms or expressions.

Return Values

The value of the last expression or atom evaluated. If expr is not supplied, repeat returns nil.

Examples

Command: (setq a 10 b 100)

100

Command: (repeat 4 (setq a (+ a 10)) (setq b (+ b 100)))

500

After evaluation, a is 50, b is 500, and repeat returns 500.

If strings are supplied as arguments, repeat returns the last string:

Command: (repeat 100 "Me" "You")

"You"