Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
minatork01 english numerals
#!/usr/bin/env ruby
num = ARGV.first.to_i
nums1 = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
nums10 = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']
if num < 10
puts nums1[num]
elsif 10 <= num && num < 20
puts nums10[num-10]
else
puts 'unsupported'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.