Product SiteDocumentation Site

5.3.6.28. previous


>>-previous(index)---------------------------------------------><

Returns the index of the item that precedes the array item having index index or the Nil object if the item having that index is first in the array. For multi-dimension arrays, the same ordering used by the allitems() (Section 5.3.6.8, “allItems”) method is used to determine the previous position and the index is returned as an array of index values.
Note that the index argument may also be specified as an array of indexes.

Example 5.152. Array class - previous method

a = .array~of("Fred", , "Mike", , "David")
say a~previous(3)  -- says: 1