Skip to content

Instantly share code, notes, and snippets.

@stevencch99
Last active January 5, 2020 11:57
Show Gist options
  • Save stevencch99/28673ed34f4c66cf67581fc537529894 to your computer and use it in GitHub Desktop.
Save stevencch99/28673ed34f4c66cf67581fc537529894 to your computer and use it in GitHub Desktop.
sample ruby-double
# 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