Sorting algorithms/Bubble sort: Difference between revisions
no edit summary
m (→{{header|Tailspin}}: syntax update) |
Drkameleon (talk | contribs) No edit summary |
||
Line 336:
( return , @x )</pre>
=={{header|Arturo}}==
<lang arturo>bubbleSort [items]{
loop $(range $(size items)-1 0) [n]{
swapped false
loop $(range 0 n-1) [i]{
if items.[i]>items.[i+1] {
tmp items.[i+1]
items.[i+1] items.[i]
items.[i] tmp
swapped true
}
}
if $(not swapped) { return items }
}
return items
}
print $(bubbleSort #(3 1 2 8 5 7 9 4 6))/lang>
{{out}}
<pre>#(1 2 3 4 5 6 7 8 9)</pre>
=={{header|AutoHotkey}}==
|