Dutch national flag problem: Difference between revisions
m
→{{header|EasyLang}}
(Corrected logic mistake) |
|||
(12 intermediate revisions by 5 users not shown) | |||
Line 1,398:
</pre>
col$[] = [ "red" "white" "blue" ]
for i to 8
b[] &= randint 3
.
for b in b[]
write col$[b] & " "
if b < b0
not_sorted = 1
.▼
b0 = b
.
print ""
print ""
if not_sorted = 0
print "already sorted"
else
for j = i + 1 to len b[]
if b[j] < b[i]
swap b[j] b[i]
.
.
.
for b in b[]
write col$[b] & " "
.
.
=={{header|Elixir}}==
Line 1,848 ⟶ 1,879:
End
</syntaxhighlight>
▲=={{header|FutureBasic}}==
▲<syntaxhighlight lang="furturebasic">
▲ for i = 0 to count - 1
▲</syntaxhighlight>
=={{header|Gambas}}==
Line 3,940 ⟶ 3,935:
i = i + 1 ' fairly efficient exchange
j = j + 1
Else If @(j) = 2
Push @(j) : @(j) = @(k) : @(k) = Pop()
k = k - 1 ' fairly efficient exchange
Line 3,962 ⟶ 3,957:
0 OK, 0:858</pre>
=={{header|UNIX Shell}}==
{{works with|Bash}}
Line 4,170 ⟶ 4,166:
=={{header|Wren}}==
{{libheader|Wren-sort}}
<syntaxhighlight lang="
import "./sort" for Sort
var colors = ["Red", "White", "Blue"]
|