Loops/Do-while: Difference between revisions

m
Moved Wren entry into correct alphabetical order.
m (Moved Wren entry into correct alphabetical order.)
(2 intermediate revisions by 2 users not shown)
Line 2,325:
inc val
echo val</syntaxhighlight>
 
=={{header|WrenNu}}==
}</syntaxhighlight lang="nu">
mut n = 0
while (true) {
$n += 1
print $n
if $n mod if (v%6 == 0) {break}
}
}</syntaxhighlight>
 
=={{header|Oberon-2}}==
Line 3,281 ⟶ 3,291:
endmodule
</syntaxhighlight>
 
=={{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.
<syntaxhighlight lang="ecmascript">var v = 0
while (true) {
v = v + 1
System.print(v)
if (v%6 == 0) break
}</syntaxhighlight>
{{out}}
<pre>
</pre>
It can also be simulated ''without'' using a break statement as follows:
<syntaxhighlight lang="ecmascript">var value = 0
var ok = true
while (ok) {
value = value + 1
System.print(value)
ok = value%6 != 0
}</syntaxhighlight>
 
{{out}}
<pre>
Same as before.
</pre>
 
=={{header|V (Vlang)}}==
Line 3,369 ⟶ 3,348:
println(n3) // prt 8
}</syntaxhighlight>
 
=={{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.
<syntaxhighlight lang="ecmascriptwren">var v = 0
while (true) {
v = v + 1
System.print(v)
if (v%6 == 0) break
}</syntaxhighlight>
{{out}}
<pre>
</pre>
It can also be simulated ''without'' using a break statement as follows:
<syntaxhighlight lang="ecmascriptwren">var value = 0
var ok = true
while (ok) {
value = value + 1
System.print(value)
ok = value%6 != 0
}</syntaxhighlight>
 
{{out}}
<pre>
Same as before.
</pre>
 
=={{header|X86 Assembly}}==
9,485

edits