RosettaCodeData/Task/Dutch-national-flag-problem/BASIC256/dutch-national-flag-problem.basic

20 lines
335 B
Text
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
arraybase 1
dim flag = {"Red","White","Blue"}
dim balls(9)
print "Random: |";
for i = 1 to 9
kolor = (rand * 3) + 1
balls[i] = flag[kolor]
print balls[i]; " |";
next i
print
print "Sorted: |";
for i = 1 to 3
kolor = flag[i]
for j = 1 to 9
if balls[j] = kolor then print balls[j]; " |";
next j
next i