From: Erik Boling Date: 2007-10-02T13:14:51+09:00 Subject: Re: instance variable/ I'm lost . You can > just access the @correct variable directly as Bob wrote: > > @correct = @correct + 1 Sorry i dont see where, bob wrote that =|. ok i understand everyones ways of going about this except bobs ways of using parameters and returned values is messing me up a bit. So heres my finished product, if anyone sees anything usless or somthing im doing wrong, please let me know :) 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 @correct = 0 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 = @correct + 1 else puts "You fail!" end end problems.to_i.times do multiply end puts correct.to_i -- Posted via http://www.ruby-forum.com/.