Product SiteDocumentation Site

5.3.6.18. hasIndex


             +-,-----+
             V       |
>>-hasIndex(---index-+-)---------------------------------------><

Returns 1 (true) if the array contains an item associated with the specified index or indexes. Returns 0 (false) otherwise.
Note that the index argument may also be specified as an array of indexes.

Example 5.143. Array class - hasIndex method

a = .array~of("Mike", "Rick", "Fred", "Rick")
say a~hasIndex(2)  -- says: 1
say a~hasIndex(5)  -- says: 0