Control Flow

While Loop

Imported from the upstream Vibescript examples at control_flow/while_loop.vibe and runnable in the browser today.

Reference View source
Source control_flow/while_loop.vibe
def countdown(start)
  out = []
  n = start
  while n > 0
    out = out + [n]
    n = n - 1
  end
  out
end

def run
  countdown(5)
end
Output
Press run to execute run from this example.
upstream control-flow browser-runner