Forum: Ruby Problem with case stmt alternatives

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
31fdda5f38fc6df4e193cfb7445ddc5a?d=identicon&s=25 RichardOnRails (Guest)
on 2009-04-12 22:56
(Received via mailing list)
Hi,

I posted my problem code on http://pastie.org/444466.

On lines 38-39 I have the code:
    case colSymbol
      when :Status ||  :Symbol ||  :TradeType ||  :Quantity || :Price

As colSymbol assumes various Symbols as values, only the first one
seems to match.
The || symbols don't seem to work in this context.

Any ideas why not?

Thanks in Advance,
Richard
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2009-04-12 23:01
(Received via mailing list)
On Apr 12, 2009, at 3:55 PM, RichardOnRails wrote:

> On lines 38-39 I have the code:
>    case colSymbol
>      when :Status ||  :Symbol ||  :TradeType ||  :Quantity || :Price
>
> As colSymbol assumes various Symbols as values, only the first one
> seems to match.
> The || symbols don't seem to work in this context.
>
> Any ideas why not?

Try:

   when :Status, :Symbol, …

James Edward Gray II
31fdda5f38fc6df4e193cfb7445ddc5a?d=identicon&s=25 RichardOnRails (Guest)
on 2009-04-12 23:17
(Received via mailing list)
On Apr 12, 5:01 pm, James Gray <ja...@grayproductions.net> wrote:
> > Any ideas why not?
>
> Try:
>
>    when :Status, :Symbol, …
>
> James Edward Gray II

Hey James,

You're spot on!

Thank you very much.

Best wishes,
Richard
This topic is locked and can not be replied to.