nth ( n seq -- elt )
Factor handbook > The language > Collections > Sequence operations > Sequence protocol

Prev:length ( seq -- n )
Next:nth-unsafe ( n seq -- elt )


Vocabulary
sequences

Inputs and outputs
na non-negative integer
seqa sequence
eltthe element at the nth index


Generic word contract
Outputs the nth element of the sequence. Elements are numbered from zero, so the last element has an index one less than the length of the sequence. All sequences support this operation.

Errors
Throws a bounds-error if the index is negative, or greater than or equal to the length of the sequence.

Definition


Methods