From: "Kenley T." Date: 2011-11-29T23:46:34+09:00 Subject: What's wrong with this code? I made a program to motivate me for the last day of NaNoWriMo, but it keeps getting 'enemy.rb:7: syntax error, unexpected kELSE, expecting $end' Please tell me what's wrong with the code. Yes, it's pretty rough, because I need to make it now, but can someone please make the code work by telling me what's wrong with it? I don't need it to be elegant or optimized, I just need to use the program. Here's the program 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 -- Posted via http://www.ruby-forum.com/.