The num.odd? function in Ruby returns true if the integer is odd; otherwise, it returns false.
Figure 1 shows the visual representation of the num.odd? function.
num.odd?
# where num is the integer which is to be checked for odd
This function does not require a parameter.
This function returns true if the integer is odd; otherwise, it returns false.
#odd numberprint "(3).odd? : ",(3).odd? , "\n"#even numberprint "(4).odd? : ", (4).odd?, "\n"