Stephen Cox wrote:
> Matthew Rudy wrote:
> 
>> def do_stuff(message_type)
>>   case message_type
>>     when :email
>>       do email stuff
>>     when :sms
>>       do sms stuff
>>   end
>>   puts "done stuff for #{message_type}"
>> end
> 
> Thanks.
> 
> but doing something like:
> 
> email = 1
> sms = 2
> 
> And then the same case statement.
> 
> But instead of testing symbols you'd test variables. Same thing right? 
> Except symbols can be used anywhere in the application? And may seem a 
> more elegant approach to strings that everything needs access too.

but with "email = 1" you don't get any reversibility.

when somethings broken,
you're in a breakpoint;

"oh, i wonder what the message type is"

> message_type
-> 1

"wow, that's useful"

:)

-- 
Posted via http://www.ruby-forum.com/.