Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 487 Bytes

twice_as_old.md

File metadata and controls

17 lines (13 loc) · 487 Bytes

Description

Your function takes two arguments:

  1. current father's age (years)
  2. current age of his son (years)

Сalculate how many years ago the father was twice as old as his son (or in how many years he will be twice as old). The answer is always greater or equal to 0, no matter if it was in the past or it is in the future.

My Solution

def twice_as_old(dad, son)
  (dad - 2*son).abs
end