github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/structs/while_doc.yaml (about) 1 - DocumentID: while 2 Title: >+ 3 `while` 4 CategoryID: commands 5 Summary: >- 6 Loop until condition false 7 Description: |- 8 `while` loops until loops until **condition** is false. 9 10 Normally the **conditional** and executed code block are 2 separate parameters 11 however you can call `while` with just 1 parameter where the code block acts 12 as both the conditional and the code to be ran. 13 Usage: |- 14 Until true 15 16 ``` 17 while { condition } { code-block } -> <stdout> 18 ``` 19 20 ``` 21 while { code-block } -> <stdout> 22 ``` 23 24 Until false 25 26 ``` 27 !while { condition } { code-block } -> <stdout> 28 ``` 29 30 ``` 31 !while { code-block } -> <stdout> 32 ``` 33 Examples: |- 34 `while` **$i** is less then **5** 35 36 ``` 37 » i=0; while { $i<5 } { i=$i+1; out $i } 38 1 39 2 40 3 41 4 42 5 43 ``` 44 45 ``` 46 » i=0; while { i=$i+1; $i<5; out } 47 true 48 true 49 true 50 true 51 false 52 ``` 53 54 `while` **$i** is _NOT_ greater than or equal to **5** 55 56 ``` 57 » i=0; !while { $i >= 5 } { $i += 1; out $i } 58 1 59 2 60 3 61 4 62 5 63 ``` 64 Flags: 65 Detail: |- 66 {{ include "gen/includes/meta-values.inc.md" }} 67 68 * `i`: iteration number 69 Synonyms: 70 - while 71 - "!while" 72 Related: 73 - formap 74 - foreach 75 - for 76 - let 77 - set 78 - global 79 - out 80 - err