Switch case not accepting 'is among' condition

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
adxsoft
Posts: 26
Joined: Wed Apr 11, 2018 12:25 pm

Switch case not accepting 'is among' condition

Post by adxsoft » Mon May 11, 2020 2:23 am

Just curious why the case statement is rejected in the IDE with
Expression: double binary operator near is

Code: Select all

switch tValue
	case is among the words "one two three"
		# .. do something
		break
	default
	       # do something else
	       break
end switch
I realise I could have put this which works fine, however, just interested in why first switch is not accepted in the IDE

Code: Select all

switch
	case tValue is among the words "one two three"
		# .. do something
		break
	default
	       # do something else
	       break
end switch

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Switch case not accepting 'is among' condition

Post by FourthWorld » Mon May 11, 2020 6:13 am

The non-working condition:

Code: Select all

case is among the words "one two three"
...attempts to compare an undefined case. There's simply nothing there to tell LC what to check among the word list for.

The working version:

Code: Select all

case tValue is among the words "one two three"
...provides an actual value to look for, the string contained in the variable tValue.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply