Loading ...
Sorry, an error occurred while loading the content.

399Syntax error : Breaking an if statement across lines

Expand Messages
  • gishu pillai
    Feb 18, 2007
    • 0 Attachment
      Hi,
      As part of my long delayed ruby learning attempt, I
      just wrote up a piece on test driving a small program
      at
      http://madcoderspeak.blogspot.com/2007/02/test-driving-conways-game-of-life-in.html

      While doing this, I hit a couple of hiccups one of
      which is...

      if I break this line into multiple lines for
      readability..

      if ( (obColony.getLiveNeighboursCount(iRow,iCol) < 2)
      or
      (obColony.getLiveNeighboursCount(iRow,iCol) > 3) )
      then
      obNewColony.markCell( iRow, iCol, false )
      end

      I get...

      GameOfLife.rb:10: syntax error
      or
      (obColony.getLiveNeighboursCount(iRow,iCol) > 3) )
      then

      if I have both the ORed clauses on the same line,
      everything works fine.

      Why is this ?

      Thanks,
      Gishu



      ____________________________________________________________________________________
      Do you Yahoo!?
      Everyone is raving about the all-new Yahoo! Mail beta.
      http://new.mail.yahoo.com
    • Show all 3 messages in this topic