Created
October 27, 2011 06:41
-
-
Save MelanieS/1318931 to your computer and use it in GitHub Desktop.
rubydoctest
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
=begin | |
doctest: My hello method returns "Hello World!" | |
>> hello | |
=> "Hello World!" | |
doctest: I can pass a name to my hello method and get "Hello Melanie" | |
>> hello "Melanie" | |
=> "Hello Melanie!" | |
doctect: I can even ask a question by passing hello "Victor", "?" | |
>> hello("Victor", "?") | |
=>"Hello victor?" | |
=end | |
def hello(name = "World", punctuation = "!") | |
"Hello #{name}#{punctuation}" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment