diff --git a/README.md b/README.md index 4f9916f7d..7b75e2021 100644 --- a/README.md +++ b/README.md @@ -918,6 +918,21 @@ Translations of the guide are available in the following languages: some_method # => false some_method(bar: true) # => true ``` +* + Prefer keyword arguments over optional arguments. +[[link](#keyword-arguments-vs-optional-arguments)] + + ```Ruby + # bad + def some_method(a, b = 5, c = 1) + # body omitted + end + + # good + def some_method(a, b: 5, c: 1) + # body omitted + end + ``` * Use keyword arguments instead of option hashes.