{"id":"language--infinite-loop-control","name":"Loop, next, and end","owner":"yeho","package":"language","kind":"language","signature":"loop { ... }\nnext\nend","description":"loop creates an explicit indefinite loop. next skips to the next iteration and end exits the nearest loop.","context":"Use loop for event pumps or retry flows with clear exit points. Use while when one condition explains the whole lifetime.","parameters":[],"returns":"","members":[],"tags":["cpu","end","language","loop","loops","next","yeho"],"updated":"2026-09-09","source":{"repository":"yeho","path":"parser_statements.cpp parseLoopStatement and parseLoopControlStatement"},"status":"stable","notes":["next and end target the nearest active loop.","The historical endLoops token is not supported."],"examples":[{"id":"complete-0","title":"Controlled indefinite loop","description":"Use loop for event pumps or retry flows with clear exit points. Use while when one condition explains the whole lifetime.","code":"int attempt = 0\nloop\n{\n    attempt = attempt + 1\n    if attempt < 3 { next }\n    Console.Log(\"Connected\")\n    end\n}\n","tags":["cpu","language"],"run":"cpu-oracle","expected":null,"verifyRun":false,"manifest":"manifestVersion = \"2\"\npackage = \"api.example.language__infinite_loop_control\"\nversion = \"0.1.0\"\nlanguageEdition = \"yeho-core-2026.1\"\n\n[app]\nkind = \"headless\"\n","verification":"type checked","sha256":"f3ebb3cff2fccd9a8b934d6a4d44444b94460f76edc6fba642fcc671abd97a44","checked":"2026-09-09","diagnostic":"","observedOutput":null,"checkedBackend":null}],"searchTerms":[],"url":"https://demonhunterlabs.com/academy/api?item=language--infinite-loop-control","json":"https://demonhunterlabs.com/reference/items/language--infinite-loop-control.json","markdown":"https://demonhunterlabs.com/reference/text/language--infinite-loop-control.md"}
