Skip to content

Latest commit

 

History

History
29 lines (24 loc) · 574 Bytes

switch_it_up.md

File metadata and controls

29 lines (24 loc) · 574 Bytes

Description

When provided with a number between 0-9, return it in words.

Input :: 1

Output :: "One".

If your language supports it, try using a switch statement.

My Solution

def switch_it_up(number)
  case number
  when 1 then 'One'
  when 2 then 'Two'
  when 3 then 'Three'
  when 4 then 'Four'
  when 5 then 'Five'
  when 6 then 'Six'
  when 7 then 'Seven'
  when 8 then 'Eight'
  when 9 then 'Nine'
  else
    'Zero'
  end
end