Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
可変長引数のサンプルソース
# 引数を元にメッセージを表示する
def display_messages(name, *messages)
messages.each do |message|
p "#{name} : #{message}"
end
end
# 実行
display_messages 'John', 'Hello', 'Goodbye', 'Thank you'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment