Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 198 Bytes

ruby.md

File metadata and controls

12 lines (9 loc) · 198 Bytes

Ruby

The way we learn at school

Contibuted by: pufe

Check if the last digit is 0, 2, 4, 6 or 8.

def isEven(x)
  %w(0 2 4 6 8).include?(x.to_s[-1])
end