REBOL Document

Index? - Function Summary


Summary:

Returns the index number of the current position in the series.

Usage:

index? series

Arguments:

series - The series argument. (must be: series port)

Description:

The index function returns the position within a series. For example, the first value in a series is an index of one, the second is an index of two, etc.


    str: "with all things considered"
    print index? str
    1


    print index? find str "things"
    10


    blk: [264 "Rebol Dr." "Calpella" CA 95418]
    print index? find blk 95418
    5

Use the OFFSET? function when you need the index difference between two positions in a series.

Related:

head - Returns the series at its head.
head? - Returns TRUE if a series is at its head.
length? - Returns the length of the series from the current position.
offset? - Returns the offset between two series positions.
pick - Returns the value at the specified position in a series.
skip - Returns the series forward or backward from the current position.
tail - Returns the series at the position after the last value.
tail? - Returns TRUE if a series is at its tail.


<Back | Index | Next>

Copyright 2004 REBOL Technologies