Skip to content

Control Flow and Loops

egyptron edited this page Sep 24, 2026 · 1 revision

Control Flow & Loops

Awake Simple S1 structures conditional execution and repetitive routines using clear block tags.


Conditional Blocks (if / else)

Conditionals in Awake Simple S1 must be wrapped in statement(start) and statement(end) delimiters.

Syntax:

statement(start)
if variable <var_name> == <value> then
   note: Statements executed when true
else
   note: Statements executed when false
statement(end)

Example:

set variable player_hp = 0

statement(start)
if variable player_hp == 0 then
   play sound "defeat"
   display_error("You fainted!")
   TerminateProcess()
else
   display_success("Still ready for battle.")
statement(end)

Repeat Loops

To loop an operation a fixed number of times, use the repeat block. The header must conclude with a colon :.

Syntax:

repeat <N> times:
   note: Loop body
finish loop;

Example:

set variable countdown = 5

repeat 5 times:
   display("Detonation in: " + countdown)
   decrease variable countdown by 1
   wait 1 seconds
finish loop;

display_error("BOOM!")

Clone this wiki locally