6 ms·
Great timing, was just reading the Swift ebook let interestingNumbers = [ "Prime": [2, 3, 5, 7, 11, 13], "Fibonacci": [1, 1, 2, 3, 5, 8], "Squar
by BlackLamb 12y ago
Great timing, was just reading the Swift ebook
let interestingNumbers = [
"Prime": [2, 3, 5, 7, 11, 13],
"Fibonacci": [1, 1, 2, 3, 5, 8],
"Square": [1, 4, 9, 16, 25],
]
var largest = 0
for (kind, numbers) in interestingNumbers {
for number in numbers {
if number > largest {
largest = number
}
}
}
largest
Excerpt From: Apple Inc. “The Swift Programming Language.”
- josephlord 12y agoNote that if you downloaded the original book into iBooks you need to delete it and download it again to get the version that matches Beta3 (fixed array semantics and new range operator ..<)
- tjl 12y agoDid both the Swift books get updated or just the one?
- josephlord 12y agoIt looks like they both did along with examples. I don't know if the changes are significant[0]. Revision history for main book: https://developer.apple.com/library/prerelease/ios/documentation/Swift/Conceptual/Swift_Programming_Language/RevisionHistory.html https://developer.apple.com/library/prerelease/ios/documenta... [0] https://developer.apple.com/library/prerelease/ios/navigation/ https://developer.apple.com/library/prerelease/ios/navigatio... and search for "swift". All the docs seem to have July dates.