FUNCTION REFERENCE

while

Repeat statements while a condition is true.

Repeat statements while a condition is true.

Syntax

while condition, statements, end

The condition is tested before each pass, as for if. The browser allows 1,000,000 execution steps per run. Desktop/CLI runs have no step limit; use Stop / Ctrl+C to end a run. Use break to leave early.

Example

n = 0; while n < 3, n = n + 1; end, n   % n = 3

Differences from MATLAB: Not checked against MATLAB yet. The browser limit of 1,000,000 execution steps per run is a MatRust limit. Desktop/CLI runs have no step limit; use Stop / Ctrl+C.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.