Hacker News new | ask | show | jobs
by BlackLamb 4356 days 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.”
1 comments

Note 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 ..<)
Did both the Swift books get updated or just the one?
It 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/documenta...

[0] https://developer.apple.com/library/prerelease/ios/navigatio... and search for "swift". All the docs seem to have July dates.