Last active
January 5, 2020 11:57
-
-
Save stevencch99/28673ed34f4c66cf67581fc537529894 to your computer and use it in GitHub Desktop.
sample ruby-double
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
# double the number | |
def double(x) | |
x * 2 | |
end | |
double(2) # => 4 | |
double(3) # => 6 | |
double(4) # => 8 | |
# squares the number | |
def square(x) | |
x * x | |
end | |
square(2) # => 4 | |
square(3) # => 9 | |
square(4) # => 16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment