Ruby 2.6
I have an variable (integer):
num_rows = 7
I would like to turn it into an array of row numbers. I did:
rows_arr = []
num_rows = 5
i = 0
while i < num_rows
rows_arr << "Row: #{i+1}"
i += 1
end
which gives me:
=> ["Row: 1", "Row: 2", "Row: 3", "Row: 4", "Row: 5"]
Is there a cleaner, or more elegant, way of doing this?