Sorting algorithms/Bubble sort: Difference between revisions

m
→‎{{header|Sidef}}: changed 'index' to 'i' making the code easier to read
m (→‎{{header|Sidef}}: removed the 'output' section)
m (→‎{{header|Sidef}}: changed 'index' to 'i' making the code easier to read)
Line 3,376:
<lang ruby>func bubble_sort(arr is Array) -> Array {
loop {
var hasChangedswapped = false;
{ |indexi|
arr[indexi-1] > arr[indexi] && (
arr[indexi-1, indexi] = arr[indexi, indexi-1];
hasChangedswapped = true;
);
} * arr.offset;
hasChangedswapped || break;
};
return arr;
2,747

edits