Check out example codes for "ruby begin rescue ensure". It will help you in understanding the concepts better.

Code Example 1

begin
  fire_ze_missiles
rescue
  retry #just once more for good luck
else
  log "We set up them the bomb."
ensure
  wtf_mate
end

Learn ReactJs, React Native from akashmittal.com