From: Charles Johnson Date: 2010-04-22T22:40:41+09:00 Subject: Re: If-Else within a loop going through array elements... On Apr 22, 2010, at 8:29 AM, Saeed Bhuta wrote: > 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/. > Try elsif instead of elseif -- Charles Johnson Vanderbilt Advanced Computing Center for Research and Education Office: 615-343-2776 Cell: 615-478-5743