0 votes
by (510 points)

I want to be able to check if a string doesn't exist in an array.

Basically, it's this except the opposite of 'contains':

(if: $inv contains "Phone")[[[Remove Phone]]]

//What I want it to do

(if: $inv does not contain "Phone")[[[Remove Phone]]]


1 Answer

+1 vote
by (159k points)
selected by
Best answer

You use the Boolean not operator to invert the Boolean value returned from the contains operator like so...

(set: $inv to (a: "Card", "Pen", "Keys"))

(if: not ($inv contains "Phone"))[You forgot your phone!]