From: "David A. Black" Date: 2009-07-19T10:18:38+09:00 Subject: Re: genie.rb:20: syntax error, unexpected $end, expecting kEND Hi -- On Sun, 19 Jul 2009, Alec Williams wrote: > I get "genie.rb:20: syntax error, unexpected $end, expecting kEND" every > I try to run the above program. It's just something I did for fun to > impress freinds/family. I've looked over it many times, trying to mess > with things a little to fix it, but nothing seems to work. I'm pretty > new to the whole programming scene (I actually started yesterday) so I > probably missed something really easy but it still baffels me. Help > would be greatly appreciated for anyone who would be kind enough to give > it. Every if statement has to have an 'end'. Right now you've got more if's than end's. It's because you're using this: else if (with no 'end' for the if) instead of: elsif They're both OK, but if you use the first one, you're starting a new if and it has to have its own end. Compare these two: if x puts "x is true" elsif y puts "y is true" else puts "Neither is true" end if x puts "x is true" else if y puts "y is true" else puts "Neither is true" end end You're doing something like the second, but without matching if/end. David -- David A. Black / Ruby Power and Light, LLC Ruby/Rails consulting & training: http://www.rubypal.com Now available: The Well-Grounded Rubyist (http://manning.com/black2) Training! Intro to Ruby, with Black & Kastner, September 14-17 (More info: http://rubyurl.com/vmzN)