A
aidy
Hi,
Here is a snippet of a case statement
read_in_test_data.each { |x|
line = x.chomp
case line
when /^Provinces:$/ || /^Town:$/
task = rovinces
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
Here is a snippet of a case statement
read_in_test_data.each { |x|
line = x.chomp
case line
when /^Provinces:$/ || /^Town:$/
task = rovinces
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