What is a predicate in the context of Ruby method naming conventions?

Technology CommunityCategory: RubyWhat is a predicate in the context of Ruby method naming conventions?
VietMX Staff asked 3 years ago

A method that answers a question posed by the method invocation or method name. Predicates typically return a boolean.

$ irb
> 5.odd?
=> true

> 5.even?
=> false

> 5.between?(1, 10)
=> true

> 5.between?(11, 20)
=> false