Dutch national flag problem: Difference between revisions

m
m (BaCon, BASIC256, and BBC BASIC moved to the BASIC section.)
(14 intermediate revisions by 5 users not shown)
Line 1,398:
</pre>
 
 
=={{header|EasyLang}}==
<syntaxhighlight>
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 i = 1 to len b[] - 1
for j = i + 1 to len b[]
if b[j] < b[i]
swap b[j] b[i]
.
.
.
for b in b[]
write col$[b] & " "
.
.
</syntaxhighlight>
 
=={{header|Elixir}}==
Line 3,904 ⟶ 3,935:
i = i + 1 ' fairly efficient exchange
j = j + 1
Else If @(j) = 2 thenThen ' case "blue"
Push @(j) : @(j) = @(k) : @(k) = Pop()
k = k - 1 ' fairly efficient exchange
Line 3,926 ⟶ 3,957:
 
0 OK, 0:858</pre>
 
=={{header|UNIX Shell}}==
{{works with|Bash}}
Line 4,134 ⟶ 4,166:
=={{header|Wren}}==
{{libheader|Wren-sort}}
<syntaxhighlight lang="ecmascriptwren">import "random" for Random
import "./sort" for Sort
 
var colors = ["Red", "White", "Blue"]
2,064

edits