From: "Kenley T." Date: 2011-11-30T00:20:34+09:00 Subject: Re: What's wrong with this code? It's still not working. Still has the same error. Here's the new code: puts 'Enter your goal words for today' @goal = gets.chomp.to_i @count = 0 @now = Time.new @thir = Time.new + (30 * 60) @en_points = 0 @ur_points = 0 while @count != @goal if @now == @thir @num = 500 + rand(300) puts "#{@num}" + ' is your enemy word count. How did you fare?' puts 'Enter how many words you typed during the thirty miinutes' @cur = gets.chomp.to_i @count = @count + @cur if @cur < @num puts 'You lost' @en_points = @en_points + 1 puts 'Enemy: ' + "#{@en_points}" + ' You: ' + "#{@ur_points}" elsif @cur == @num puts 'A tie' puts 'Enemy: ' + "#{@en_points}" + ' You: ' + "#{@ur_points}" else puts 'You won' @ur_points = @ur_points + 1 puts 'Enemy: ' + "#{@en_points}" + ' You: ' + "#{@ur_points}" end else @now = Time.new end end if @en_points > @ur_points puts 'You lost despite success.' elsif @en_points == @ur_points puts 'A tie, but you succeeded in writing a lot of words.' else puts 'Multiple victories!' end I think you should try running it just to be safe, so the file is attached. Thanks! Attachments: http://www.ruby-forum.com/attachment/6803/enemy.rb -- Posted via http://www.ruby-forum.com/.