Skip to content

Instantly share code, notes, and snippets.

@Y-Fujikawa
Last active June 18, 2017 05:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save Y-Fujikawa/0156c005309e6722d858bb67c4b61817 to your computer and use it in GitHub Desktop.
キーワード引数(デフォルト値あり)のサンプルソース
# 引数を元にメッセージを表示する
def display_message(name: 'Smith', message: 'Sample')
p "#{name} : #{message}"
end
display_message
display_message(name: 'John', message: 'Hello')
display_message(message: 'Hello', name: 'John')
display_message('John', 'Hello')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment