Page 1 of 1

Switch case not accepting 'is among' condition

Posted: Mon May 11, 2020 2:23 am
by adxsoft
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

Re: Switch case not accepting 'is among' condition

Posted: Mon May 11, 2020 6:13 am
by FourthWorld
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.