In my below code, I put one rescue clause. But I couldn’t trace why the two end was clashing between them. Could you help me to find out the reason- why so?
CODE:
n=1
until n > 4 do
begin
1/0
(1..4).each do |l|
if 'B' == 'B'
if 1 != 0
p 'dog'
end
end
if 'A' == 'A'
if 1 != 0
p 'cat'
end
end
end
If true == true
p 'hi'
end
rescue
p 'exception'
end
n=n+1
end
Error:
E:/WIPData/Ruby/Scripts/test.rb:64: syntax error, unexpected keyword_rescue, exp
ecting keyword_end
E:/WIPData/Ruby/Scripts/test.rb:71: syntax error, unexpected keyword_end, expect
ing $end
Pascal-cased
Ifis not a valid ruby keyword. Therefore, itsendmatches another opening keyword instead.