Skip to content

Instantly share code, notes, and snippets.

@Y-Fujikawa
Created June 18, 2017 05:21
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/2afa4c9f7cfc61352f858947a367e799 to your computer and use it in GitHub Desktop.
Save Y-Fujikawa/2afa4c9f7cfc61352f858947a367e799 to your computer and use it in GitHub Desktop.
キーワード引数(デフォルト値なし)のサンプルソース
# 引数を元にメッセージを表示する
def display_message(name:, message:)
p "#{name} : #{message}"
end
display_message(name: 'John', message: 'Hello')
display_message(message: 'Hello', name: 'John')
display_message
display_message('John', 'Hello')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment