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 echo (word) | |
| word | |
| end | |
| def shout (word) | |
| word.upcase | |
| end | |
| def repeat (word, times = 2) | |
| (word * times).gsub(word, " #{word}").strip |
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 add (num1, num2) | |
| num1 + num2 | |
| end | |
| def subtract (num1, num2) | |
| num1 - num2 | |
| end | |
| def sum (array) | |
| answer = 0 |
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 ftoc (fahrenheit) | |
| (fahrenheit - 32) * 5/9.to_f | |
| end | |
| def ctof (celsius) | |
| celsius * 9/5.to_f + 32 | |
| end |
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 hello | |
| "Hello!" | |
| end | |
| def greet(name) | |
| "Hello, #{name}!" | |
| end |
NewerOlder