From: Erik Boling Date: 2007-10-02T12:10:55+09:00 Subject: Re: instance variable/ I'm lost alright wow thanks for all the posts, ok i understand ur guys's ways, but look at this puts 'How many problems do you want to solve?' problems = gets.chomp 5.downto(1) do |x| puts "The test will beging #{x} in seconds! " sleep 1 end puts 'Start!' def correct=(correct) @correct = correct end def correct @correct end def multiply multiple2 = rand(11) multiple1 = rand(11) answer = multiple1 * multiple2 puts 'what is ' + multiple1.to_s + ' * ' + multiple2.to_s + ' ?' answerp = gets.chomp if answer.to_s == answerp.to_s puts "good job" correct.to_i + 1 else puts "You fail!" end end problems.to_i.times do multiply end puts correct.to_i for some reason the variable wont change it just returns nil each time :( what do i need to fix? -- Posted via http://www.ruby-forum.com/.