Methods of Ruby’s Integer Class
Learn about the methods that are available in Ruby for the integer class.
We'll cover the following...
There are not too many integer class methods, and it’s worth looking at the documentation to better understand what’s available for a programmer. In the upcoming sections, we’ll take a close look at some of them.
even?
and odd?
even?
or odd?
are two methods of the integer class whose method names have a question mark at the end by default.
We can use any of these two methods to check if an integer is even or odd. ...