Case statment not working with strings

Hello, I have a rather simple case statement:

case event[‘event_title’]
when (‘Class GroupsPhoto Day’ || ‘Retake Day’ || ‘School Group’ ||
‘Photo’ || ‘Staff Group Photo’ || ‘Staff Group Photo’ || ‘Teams and
Clubs’ || ‘Group Photo Session’)
blah…
end

the thing stored in event[‘event_title’] is a string and the values do
match my strings (ie should evaluate to true), but the case is never
evaluating to true.

any help appreciated, I could always use a big ugle if/elsif

2008/8/2 Mike M. [email protected]:

Hello, I have a rather simple case statement:

case event[‘event_title’]
when (‘Class GroupsPhoto Day’ || ‘Retake Day’ || ‘School Group’ ||
‘Photo’ || ‘Staff Group Photo’ || ‘Staff Group Photo’ || ‘Teams and
Clubs’ || ‘Group Photo Session’)
blah…
end

Use a ‘,’ instead of ‘||’

Farrel

Thanks, also had to remove the parens

Mike M. wrote:

Thanks, also had to remove the parens

Your code also got rid of a few chars! I like it whenever in Ruby I
successfully apply the rule “less is more” to achieve the same. :slight_smile: