I have an array defined like this,
result = ["true","false","false","false"]
In my code I iterate through the array and raise an exception when i come across false.
begin result.each do |method|
raise if (method == false) {
rescue Exception => Form_Validation_Failure
puts "fail!"
end }
end
There is an error when i execute the code.Is this is the right way to raise and exception in Ruby? Could somebody help with this please.
Cheers!
In addition to using strings in your array and the constant
falsein your comparison, I see a rescue inside braces.I think the form of code you are looking for is: