Credits Overview Plotting Styles Commands Terminals

Array indexing

Array indices run from 1 to N for an array with N elements. Element i of array A is accessed by A[i]. The built-in function index(Array, <value>) returns an integer i such that A[i] is equal to <value>, where <value> may be any expression that evaluates to a number (integer, real, or complex) or a string. The array element must match in both type and value. A return of 0 indicates that no match was found.

    array A = [ 4.0, 4, "4" ]
    print index( A, 4 )
          2
    print index( A, 2.+2. )
          1
    print index( A, "D4"[2:2] )
          3