Check out example codes for "exit program ruby". It will help you in understanding the concepts better.

Code Example 1

# You can exit by calling a method
exit
exit!
abort("She cannot take any more of this, Captain!")

# ...or by failing to catch an exception
raise("Destroyed...")
fail

# ...or by letting the program end naturally. :)

Learn ReactJs, React Native from akashmittal.com