Created
November 7, 2012 22:15
-
-
Save shepmaster/4034868 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| def round_to(num, places) # Pass in both parameters | |
| (num * 10 ** places).round.to_f / 10 ** places | |
| end | |
| def ftoc(num) | |
| answerc = ((num - 32) / 1.8) | |
| puts "ftoc spits out #{self.class}" | |
| round_to(answerc, 1) | |
| end | |
| def ctof(num) | |
| answerf = ((num - 32) / 1.8) | |
| puts "ctof spits out #{self.class}" # can use #{} to insert strings | |
| round_to(answerf, 1) # no need to say `return` on the last line | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment