in?

check if value exists in given collection


Parameters

in? value :any
    collection :string :dictionary :object :block :range

Attributes

at:integercheck at given location within collection
deepsearches recursively in deep for a value.

Returns

  • :logical

Examples

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

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

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

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

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

copy
print in?.deep 6 [1 2 4 [3 4 [5 6] 7] 8 [9 10]] ; true

copy
user: #[ name: "John" surname: "Doe" mom: #[ name: "Jane" surname: "Doe" ] ] print in?.deep "Jane" user ; true

Related