[Solved] Add a number through out a loop
[ad_1] It’s because of variable scope, you should move x definition out: base_times=14 x=3 base_times.times do |i| x += 2.50 puts “#{x}” end Also there’s syntactic sugar for x = x +, +=. 3 [ad_2] solved Add a number through out a loop