Skip to content

Instantly share code, notes, and snippets.

@rbishop
Last active December 10, 2015 23:18
Show Gist options
  • Select an option

  • Save rbishop/4508218 to your computer and use it in GitHub Desktop.

Select an option

Save rbishop/4508218 to your computer and use it in GitHub Desktop.
times table
def times_table number
multiplier = 1
while multiplier <= number
range = (1..number).to_a
row = range.map do |x|
x * multiplier
end
puts row.join(' ')
multiplier += 1
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment