What is integer? in Ruby?
The num.integer? function in Ruby returns true if the number is an integer; otherwise, it returns false.
Figure 1 shows the visual representation of the num.integer? function.
Syntax
num.integer?
# where num is the number which is to be checked for integer
Return value
This function returns true if the number is an integer; otherwise, it returns false.
Example
#non-integerprint "(3.3).integer? : ",(3.3).integer? , "\n"#integerprint "(4).integer? : ",(4).integer?, "\n"