Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Validate An Odd Or Even Number In Ruby

DZone's Guide to

Validate An Odd Or Even Number In Ruby

· Mobile Zone ·
Free Resource

x%2 == 0 ? true : false

x = 5
x%2 == 0 ? true : false
#=> false

x = 8
x%2 == 0 ? true : false
#=> true


Topics:
ruby

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}