Skip to content

Instantly share code, notes, and snippets.

@kayluhb
Last active August 29, 2015 14:11
Show Gist options
  • Save kayluhb/edc8eef1a12caf495a6a to your computer and use it in GitHub Desktop.
Save kayluhb/edc8eef1a12caf495a6a to your computer and use it in GitHub Desktop.
Multiplication tables in Ruby
multipliers = (1..9)
multipliers.each do |x|
print multipliers.map {|y|
s = y * x
"#{s < 10 ? ' ' : ''}#{s}"
}.join(' ')
print "\n"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment