nth

AutoCad AutoLISP Functions

 
nth
 
 
 

Returns the nth element of a list

(nth n lst)

Arguments

n

The number of the element to return from the list (zero is the first element).

lst

The list.

Return Values

The nth element of lst. If n is greater than the highest element number of lst, nth returns nil.

Examples

Command: (nth 3 '(a b c d e))

D

Command: (nth 0 '(a b c d e))

A

Command: (nth 5 '(a b c d e))

nil