Handy numerical methods 🔖

Handy numerical methods you can use on daily basis in comparison statements in Ruby 🧮

Code snippet 📌

 num = 10

 num.even?        # same as num % 2 == 0
 true

 num.odd?         # same as num % 2 != 0
 false

 num.positive?    # same as num > 0
 true

 num.negative?    # same as num < 0
 false

 num.zero?        # same as num == 0
 false

 num.integer?     # same as num.is_a?(Integer)
 true