Given I have an integer value of, e.g., 10.
10
How can I create an array of 10 elements like [1,2,3,4,5,6,7,8,9,10]?
[1,2,3,4,5,6,7,8,9,10]
You can do this:
array= Array(0..10)
If you want to input, you can use this:
puts "Input:" n=gets.to_i array= Array(0..n) puts array.inspect