Skip to content

Instantly share code, notes, and snippets.

@fitomad
Created November 17, 2015 12:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fitomad/ed21f44fffc147b680bf to your computer and use it in GitHub Desktop.
Save fitomad/ed21f44fffc147b680bf to your computer and use it in GitHub Desktop.
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