Product SiteDocumentation Site

5.3.6.19. hasItem


>>-hasItem(item)-----------------------------------------------><

Returns 1 (true) if the array contains the specified item at any index location. Returns 0 (false) otherwise. Item equality is determined by using the == method of item.

Example 5.144. Array class - hasItem method

a = .array~of("Mike", "Rick", "Fred", "Rick")
say a~hasItem("Rick")  -- says: 1
say a~hasItem("Mark")  -- says: 0