[Rails] Re: Need suggestion how can I skip the rest par inside a loop when erro is raised

2013-09-12 Thread Love U Ruby
Joel Pearson wrote in post #1121289: > Just use error handling properly. > > begin > #standard code > rescue I am looking for the below operations,but only when error will be occured : a = (1..10) i=0 until a.size>10 next i+=1 if i<5 # this should be done on Error p a[i] i+=1 end If still I

[Rails] Re: Need suggestion how can I skip the rest par inside a loop when erro is raised

2013-09-12 Thread Joel Pearson
Maybe a real example would help, rather than infinite-loop pseudo-code. val = -3 until val > 2 begin val +=1 1/val rescue puts 'Error on ' + val.to_s else puts 'No Error on ' + val.to_s end puts 'Finished with ' + val.to_s end -- Posted via http://www.ruby-forum.com/.

[Rails] Re: Need suggestion how can I skip the rest par inside a loop when erro is raised

2013-09-12 Thread Joel Pearson
Just use error handling properly. begin #standard code rescue #only runs if an error occurred else #only runs if an error did not occur ensure #always runs at the end regardless of error level end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed