From: Saeed Bhuta Date: 2010-04-22T22:29:35+09:00 Subject: Re: If-Else within a loop going through array elements... Glenn Jackman wrote: > At 2010-04-22 09:12AM, "Saeed Bhuta" wrote: > [... the code you pasted ...] >> else if i == 2 > > [... the error you show ...] >> riverservicescraper.rb:56: syntax error, unexpected kELSE, expecting '}' >> else if i == 2 { >> ^ > > Is the code you're editing different from the code you're running? > Did you forget to save in your editor? Apologies for the confusion, I changed the else if to elseif and now getting the following error: abcb293@apostis:~/Ruby-Scraper$ ruby riverservicescraper.rb board divs found: 1 if statement is working for first condition riverservicescraper.rb:56: undefined method `elseif' for # (NoMethodError) from riverservicescraper.rb:32:in `each' from riverservicescraper.rb:32 from riverservicescraper.rb:22:in `each' from riverservicescraper.rb:22 -- Posted via http://www.ruby-forum.com/.