On Wednesday, August 16, 2006, at 1:35 AM, aidy wrote:
>Hi,
>
>Here is a snippet of a case statement
>
> read_in_test_data.each { |x|
> line = x.chomp
> case line
> 	 when /^Provinces:$/ || /^Town:$/
> 	 	task = :provinces
> else
>     #whatever
> end
>
> || should evaluate to true if either operands are true.
>
> When I ran through the debugger:
>
> var line == "Provinces:" # the task is set
> var line == "Town:" # the task is not set
>
> I change the expression to &&
>
> when /^Provinces:$/ && /^Town:$/
>
> var line == "Provinces:" # the task is not set
> var line == "Town:" # the task is set
>
> Could anyone tell me what I am doing wrong?
>
> aidy
>
>

Why not do something like this...

when /^(Provinces|Town):$/

_Kevin
www.sciwerks.com

-- 
Posted with http://DevLists.com.  Sign up and save your mailbox.