1

This is the code

GrassFilledX = GrassGenX
GrassFilledY = GrassGenY

GrassFillL = True

while GrassFillL == True:
    if gx == hgx or hgx2:



while not crashed:

The error says

while not crashed:
^
IndentationError: expected an indented block
iBug
  • 35,554
  • 7
  • 89
  • 134
AlphaRobot
  • 11
  • 1

1 Answers1

1

Python expects an indented block after an if statement.

If you want an empty block, use pass:

while GrassFillL == True:
    if gx == hgx or hgx2:
        pass

while not crashed:

This has the same effect in other languages as an empty pair of braces, like if(condition){}. In Python you're not allowed to leave a block empty, you must at least have an NOP statement, the pass, in the block, to make the program valid.

This is a similar (yet essentially the same) use case of pass.

iBug
  • 35,554
  • 7
  • 89
  • 134
  • continue, would also work. But there is one difference, pass will do nothing and continue will skip the current iteration to next iteration. I don't know what he really wants, just info. – oakca Jan 31 '18 at 16:14