Overview - Method naming conventions (? and ! suffixes)
What is it?
In Ruby, method names can end with special characters like '?' and '!'. The '?' suffix is used for methods that answer a yes/no question, returning true or false. The '!' suffix indicates that the method performs a more dangerous or surprising action, often modifying the object it is called on. These conventions help programmers understand what a method does just by its name.
Why it matters
Without these naming conventions, it would be harder to guess what a method does, leading to bugs or unexpected behavior. For example, a method that changes data might be mistaken for one that only checks something. These suffixes make code clearer and safer, improving communication between programmers and reducing mistakes.
Where it fits
Before learning this, you should understand basic Ruby methods and how to define and call them. After this, you can learn about Ruby's object mutability, method chaining, and best practices for writing clean, readable code.