Skip to content

Instantly share code, notes, and snippets.

@MelanieS
Created October 27, 2011 06:41
Show Gist options
  • Save MelanieS/1318931 to your computer and use it in GitHub Desktop.
Save MelanieS/1318931 to your computer and use it in GitHub Desktop.
rubydoctest
=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