Predicate Methods
Learn about the predicate methods in Ruby and how to use them.
We'll cover the following
Predicate methods
If we look at the list of methods defined for a String
object, we see that there are methods that end with a question mark (?
).
In Ruby convention, these methods return either true
or false
. For example, we can ask a number if it’s even or odd:
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy