Created
November 12, 2012 15:37
-
-
Save chyld/4060029 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
puts "GIMMIE A NUMBER!" | |
response = gets.to_i | |
# asks the user for a number and stores the input into variable response | |
begin | |
response.explode | |
# explodes the program and causes an error | |
rescue | |
puts "The square of #{response} is #{response**2}." | |
# initiates the rescue code if the program fails | |
end | |
# ,---, ,---, ,---, | |
# ,`--.' | ,`--.' | ,`--.' | | |
# .---. ,---, ,---,| : : | : : | : : | |
# /. ./| .' .' `\ ,`--.' |' ' ; ' ' ; ' ' ; | |
# .--'. ' ;,---.' \ | : :| | | | | | | | | | |
# /__./ \ : || | .`\ |: | '' : ; ' : ; ' : ; | |
# .--'. ' \' .: : | ' || : || | ' | | ' | | ' | |
# /___/ \ | ' '| ' ' ; :' ' ;' : | ' : | ' : | | |
# ; \ \; :' | ; . || | |; | ; ; | ; ; | ; | |
# \ ; ` || | : | '' : ;`---'. | `---'. | `---'. | | |
# . \ .\ ;' : | / ; | | ' `--..`; `--..`; `--..`; | |
# \ \ ' \ || | '` ,/ ' : |.--,_ .--,_ .--,_ | |
# : ' |--" ; : .' ; |.' | |`. | |`. | |`. | |
# \ \ ; | ,.' '---' `-- -`, ;`-- -`, ;`-- -`, ; | |
# '---" '---' '---`" '---`" '---`" | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment