Overview - Predicate methods (ending with ?)
What is it?
Predicate methods in Ruby are special methods that end with a question mark (?). They return a true or false value, answering a yes-or-no question about an object or condition. These methods help write clear and readable code by expressing checks or tests directly. For example, a method named empty? tells you if something is empty or not.
Why it matters
Predicate methods make code easier to understand and maintain by clearly showing when a method is meant to answer a yes/no question. Without them, programmers might use unclear method names or return values that are harder to interpret, leading to confusion and bugs. They help communicate intent directly, making collaboration and debugging smoother.
Where it fits
Before learning predicate methods, you should understand basic Ruby methods and boolean values (true and false). After mastering predicate methods, you can explore custom method naming, Ruby conventions, and writing expressive code with other special method suffixes like bang (!) methods.