arr = [2,4,6,8]
i = 0
while i < arr.length do
puts arr[i + 1] - arr[i]
i = i + 1
end
It puts out the values on the console but also issues an error
ERROR (on RubyMine 7): C:\Ruby21\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/.../file/application.rb 2 2 2 C:/Users/inoor/RubymineProjects/file/application.rb:4:in
<top (required)>': undefined method
-' for nil:NilClass (NoMethodError) from -e:1:inload' from -e:1:in
'Process finished with exit code 1
Can someone please help me understand what's going on?