REBOL 3 Docs Guide Concepts Functions Datatypes Errors
  TOC < Back Next >   Updated: 3-Aug-2010 Edit History  

REBOL 3 Functions: at

at  series  index

Returns the series at the specified index.

Arguments:

series [series! gob! port!]

index [number! logic! pair!]

See also:

skip   pick   head   tail  

Description

Provides a simple way to index into any type of series. at returns the series at the new index point.

Note that the operation is relative to the current position within the series.

A positive integer N moves to the position N in the series:

numbers: [11 22 33]
print at numbers 2
22 33

An index of 0 is the same as an index of 1:

print at numbers 0
11 22 33

Using a negative index N, you can go N values backwards in a series:

numbers: at numbers 3
print numbers
33
print at numbers -1
22 33

More examples, combined with other series functions:

words: [grand grape great good]
print first at words 2
grape
remove at words 2
insert at words 3 [super]
probe words
[grand great super good]


  TOC < Back Next > REBOL.com - WIP Wiki Feedback Admin