Skip to content

Commit 8da637c

Browse files
Removes Swift 4.0 check.
Removes unused import. Refactors an if statement into a guard to be more Swift-y.
1 parent 17a1e4c commit 8da637c

File tree

2 files changed

+2
-10
lines changed

2 files changed

+2
-10
lines changed

Slow Sort/SlowSort.playground/Contents.swift

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
// last checked with Xcode 9.0b4
2-
#if swift(>=4.0)
3-
print("Hello, Swift 4!")
4-
#endif
5-
61
var numberList = [1, 12, 9, 17, 13, 12]
72

83
slowsort(0, numberList.count-1, &numberList)

Slow Sort/SlowSort.swift

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,9 @@
66
//
77
//
88

9-
import Foundation
10-
119
public func slowsort(_ i: Int, _ j: Int, _ numberList: inout [Int]) {
12-
if i>=j {
13-
return
14-
}
10+
guard i<j else { return }
11+
1512
let m = (i+j)/2
1613
slowsort(i, m, &numberList)
1714
slowsort(m+1, j, &numberList)

0 commit comments

Comments
 (0)