Last active
December 10, 2015 23:18
-
-
Save rbishop/4508218 to your computer and use it in GitHub Desktop.
times table
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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