Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Break Statement

From Groundhog Learning
Revision as of 16:03, 21 October 2025 by Groundhog (talk | contribs) (Updated via bot)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A command that immediately exits a loop, regardless of its condition.

Details

The break statement is useful when you want to stop a loop early.

🤖 Pseudocode

while playerIsAlive
    if playerQuits
        exit game
    run game logic

After break, the program continues with the first statement after the loop.

Related Concepts

Related Actions

References