Over a million developers have joined DZone.

Validate An Odd Or Even Number In Ruby

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.


x%2 == 0 ? true : false

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

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


The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.

Topics:
ruby

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

{{ parent.tldr }}

{{ parent.urlSource.name }}