That's the wrong syntax for ranges.
You've made an array with 1 element, and that element is itself the range 1..100
. What you've written is equivalent to [(1.100)]
. You're iterating over the outer array one time, and setting x
to (1..100)
You want (1..100).each
, which invokes each
on the range, not on an array containing the range.