Skip to content

Instantly share code, notes, and snippets.

@rubysolo
Created February 1, 2010 18:41
Show Gist options
  • Select an option

  • Save rubysolo/291892 to your computer and use it in GitHub Desktop.

Select an option

Save rubysolo/291892 to your computer and use it in GitHub Desktop.
def output(*words)
case words.length
when 0
puts "no words"
when 1
puts "here is my word: #{words.first}"
else
puts "here are my words: #{words.join(',')}"
end
end
>> output
no words
>> output 'foo'
here is my word: foo
>> output 'foo', 'bar', 'baz'
here are my words: foo,bar,baz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment