Last active
November 17, 2015 15:07
-
-
Save fitomad/fe21a9ad6d676374a7ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mutable_array: [Int] = [ 2, 8, 10, 3, 6, 5, 4, 7, 1, 9] | |
mutable_array.sortInPlace() | |
{ | |
let pares: (lhs: Bool, rhs: Bool) = (lhs: ($0 % 2 == 0), rhs: ($1 % 2 == 0)) | |
switch pares | |
{ | |
case (true, false): | |
return false | |
case (false, true): | |
return true | |
default: | |
return $0 < $1 | |
} | |
} | |
print(mutable_array.descriptionWithSeparator(", ")) | |
// En la consola de depuración se verá... | |
// 1, 3, 5, 7, 9, 2, 4, 6, 8, 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment