Find an item in a list
Check whether a particular value appears anywhere in a list. A single match is enough.
in
Simple example
Does the list contain two?
Start1 · 2 · 3
Resulttrue
function main()
values = [1, 2, 3]
println(2 in values)
end
main()
true
Advertisements
Everyday examples
Is ticket 17 on the pickup list?
Start15 · 17 · 20
Resulttrue
function main()
values = [15, 17, 20]
println(17 in values)
end
main()
true
Does this bus stop at stop 6?
Start2 · 4 · 8
Resultfalse
function main()
values = [2, 4, 8]
println(6 in values)
end
main()
false
Is parcel 42 on the van?
Start42 · 18 · 15
Resulttrue
function main()
values = [42, 18, 15]
println(42 in values)
end
main()
true