Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@Y-Fujikawa
Created June 17, 2017 06:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Y-Fujikawa/633a7e408b04e4ea3758be19b664394f to your computer and use it in GitHub Desktop.
Save Y-Fujikawa/633a7e408b04e4ea3758be19b664394f to your computer and use it in GitHub Desktop.
可変長引数のサンプルソース
# 引数を元にメッセージを表示する
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