Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
let fixed_array: [Int] = [ 2, 1, 4, 3, 6, 5, 8, 7, 10, 9]
var mutable_array: [Int] = [ 2, 8, 10, 3, 6, 5, 4, 7, 1, 9]
let new_fixed_array = fixed_array.sort()
mutable_array.sortInPlace()
print("> mutable: \(mutable_array.descriptionWithSeparator(", "))")
print("> fixed: \(fixed_array.descriptionWithSeparator(", "))")
print("> new fixed: \(new_fixed_array.descriptionWithSeparator(", "))")
// En la consola de depuración veremos...
// > mutable: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
// > fixed: 2, 1, 4, 3, 6, 5, 8, 7, 10, 9
// > new fixed: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.