Contents

Roo

Array.contains?()

Returns True if this array contains the specified object, False otherwise. First the method looks to see if the exact object exists in the array (with a memory lookup). If it doesn’t, the method then checks the values of Boolean, Number and Text objects to find a match.

array.contains?(what as Object) as Boolean

Parameters

  • what. Object. The object you are searching for

Returns

  • Boolean

Example

var a = ["a", 10, True]
var bool = True
a.contains?("a") # => True
a.contains?("A") # => False
a.contains?(bool) # => True