Skip to content

Instantly share code, notes, and snippets.

@kenrett
Created Feb 23, 2013
Embed
What would you like to do?
def times_table(rows)
if rows == 0
return false
end
array = []
counter = 1
while counter <= rows
1.upto(rows) do |i|
array << i*counter
end
counter += 1
end
puts array.join(' ')
end
times_table(5)
times_table(10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment