PMroz,
Let me start by confirming that the code you wrote worked for me as well, and the explaination I wrote is not consistent with JMP 9 or 10 behavior.
After reading your reply, I also tried several different combinations of contains, and if statements with lists, string, and numbers in JMP 9 and 10. Although my attempts were not exhaustive, all of my results are consistent with yours. Initially, when I read your first post I recalled some troubleshooting that I had perform years prior where I had adopted the the use of contains()>0. I am unable to recreate the scenario; however, I did find the following information in the JMP scripting guide. It details using contains with >0, which may be appropriate for their example, but does not explicitly state that it is or is not required.
Page 136 of the JMP scripting guide version 10:
"To assess whether an item is in a list, use Loc() and Contains() with >0. A returned value of zero
means that the item is not in the list. A returned value of 1 means that the item is in the list at least once."
...
"Find out if the number 5 exists in the numList:
NRow(Loc(numList, 5)) >0;
0
Contains(numList, 5) >0;
0"
Hope this helps.