Skip to content

Latest commit

 

History

History
17 lines (14 loc) · 449 Bytes

if_you_cant_sleep_just_count_sheep.md

File metadata and controls

17 lines (14 loc) · 449 Bytes

Description

If you can't sleep, just count sheep!!

Task:

Given a non-negative integer, 3 for example, return a string with a murmur: "1 sheep...2 sheep...3 sheep...". Input will always be valid, i.e. no negative integers.

My Solution

def count_sheep(num)
  str = ''
  num.times {|n| str << "#{n+1} sheep..." }
  str
end