contains?

check if collection contains given value


Parameters

contains? collection :string :dictionary :block :range
          value :any

Attributes

at:integercheck at given location within collection

Returns

  • :logical

Examples

copy
arr: [1 2 3 4] contains? arr 5 ; => false contains? arr 2 ; => true

copy
user: #[ name: "John" surname: "Doe" ] contains? dict "John" ; => true contains? dict "Paul" ; => false contains? keys dict "name" ; => true

copy
contains? "hello" "x" ; => false contains? "hello" `h` ; => true

copy
contains?.at:1 "hello" "el" ; => true contains?.at:4 "hello" `o` ; => true

copy
print contains?.at:2 ["one" "two" "three"] "two" ; false print contains?.at:1 ["one" "two" "three"] "two" ; true

Related