0
running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
            running = False
            pygame.quit()
            sys.exit()

File "C:\Users\ADMIN\PycharmProjects\pythonProject\main.py", line 12 running = False ^ IndentationError: expected an indented block

expected an indented block

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
alex
  • 11
  • 4
  • 1
    `running = False` and the following lines should be indented beneath the `if` – Cresht Dec 17 '21 at 17:01
  • You have to add spaces before `running = False` and subsequent lines to let python know that this block is inside the `if` statement. That's what indented block means. – qouify Dec 17 '21 at 17:01

1 Answers1

1

Should it be:

while running:
    for event in pygame.event.get():
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:
                running = False
                pygame.quit()
                sys.exit()
qouify
  • 3,698
  • 2
  • 15
  • 26
Cal-cium
  • 654
  • 12
  • 22