Skip to content

while repeats

  • while (test) { ... } runs again and again, as long as the test stays true.
  • It checks the test before each pass — so the body might run zero times.

While lives > 0 the body runs lives-- and tests again; when the test is false it prints game over

Handout

Log in or create account

IGCSE, A-Level & AP