whileLoop until condition false
while loops until loops until condition
is false.
Normally the conditional and executed code block are
2 separate parameters however you can call while with just
1 parameter where the code block acts as both the conditional and the
code to be ran.
while { condition } { code-block } -> <stdout>
while { code-block } -> <stdout>
!while { condition } { code-block } -> <stdout>
!while { code-block } -> <stdout>
while $i is less then
5
» i=0; while { $i<5 } { i=$i+1; out $i }
1
2
3
4
5
» i=0; while { i=$i+1; $i<5; out }
true
true
true
true
false
while $i is NOT greater than
or equal to 5
» i=0; !while { $i >= 5 } { $i += 1; out $i }
1
2
3
4
5
Meta values are a JSON object stored as the variable $..
The meta variable will get overwritten by any other block which invokes
meta values. So if you wish to persist meta values across blocks you
will need to reassign $., eg
%[1..3] -> foreach {
meta_parent = $.
%[7..9] -> foreach {
out "$(meta_parent.i): $.i"
}
}
The following meta values are defined:
i: iteration numberwhile!whileglobal: Define a global variable and set it’s
valueset:
Define a variable (typically local) and set it’s valueerr: Print a line to the stderrformap: Iterate through a map or other collection of
dataforeach: Iterate through an arrayfor: A more
familiar iteration loop to existing developerslet: Evaluate a mathematical function and assign to
variable (removed 7.0)out: Print a string to the stdout with a trailing new
line characterThis document was generated from builtins/core/structs/while_doc.yaml.
This site's content is rebuilt automatically from murex's source code after each merge to the master branch. Downloadable murex binaries are also built with the website.
Last built on Wed Dec 10 23:24:04 UTC 2025 against commit ec623f9ec623f9e05b9cd816d1c93e90c807e23ff173cd9.
Current version is 7.1.4143 (unknown) which has been verified against tests cases.