Last active
December 19, 2015 14:09
-
-
Save elreimundo/5967472 to your computer and use it in GitHub Desktop.
So I thought this would show a (not-very-well-spaced) times table with individual values separated by a space and each row on a new line. What am I missing?
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(rows) | |
bigarray = [] | |
1.upto(rows) do |x| | |
newarrayrow=[] | |
1.upto(rows) do |y| | |
newarrayrow << x*y | |
end | |
bigarray << newarrayrow.join(' ') | |
end | |
puts bigarray.join("\n") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Important to include puts in the last line