nth (AutoLISP)

Returns the nth element of a list

Supported Platforms: Windows and Mac OS

Signature

(nth n lst)
n

Type: Integer

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

lst

Type: List

The list with one or more elements.

Return Values

Type: Integer, Real, String, List, ads_name, T, or nil

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

Examples

(nth 3 '(a b c d e))
D

(nth 0 '(a b c d e))
A

(nth 5 '(a b c d e))
nil