Loops/Do-while: Difference between revisions
Content deleted Content added
imported>Brie Add Nu |
m →{{header|Wren}}: Changed to Wren S/H |
||
Line 3,294: | Line 3,294: | ||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
Wren doesn't have a ''do/while'' loop as such but we can simulate it using an infinite loop with a final conditional break. |
Wren doesn't have a ''do/while'' loop as such but we can simulate it using an infinite loop with a final conditional break. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">var v = 0 |
||
while (true) { |
while (true) { |
||
v = v + 1 |
v = v + 1 |
||
Line 3,310: | Line 3,310: | ||
</pre> |
</pre> |
||
It can also be simulated ''without'' using a break statement as follows: |
It can also be simulated ''without'' using a break statement as follows: |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">var value = 0 |
||
var ok = true |
var ok = true |
||
while (ok) { |
while (ok) { |