Upgrade to Pro — share decks privately, control downloads, hide ads and more …

I ♥ Swift

Pat Hawks
February 19, 2016

I ♥ Swift

A talk about what makes Swift so cool

Pat Hawks

February 19, 2016
Tweet

More Decks by Pat Hawks

Other Decks in Technology

Transcript

  1. final int[] individualScores = [75, 43, 103, 87, 12]; int

    teamScore = 0; for (int score : individualScores) { if (score > 50) { teamScore += 3; } else { teamScore += 1; } } System.out.printf("%d\n", teamScore); let individualScores = [75, 43, 103, 87, 12] var teamScore = 0 for score in individualScores { if score > 50 { teamScore += 3 } else { teamScore += 1 } } print(teamScore)
  2. int accumulator = 0; for (int i = 0; i

    <= 4; ++i) { accumulator += i; } System.out.printf("%d\n", accumulator); var accumulator = 0 for i in 0...4 { accumulator += i } print(accumulator)
  3. var accumulator = 0 for i in 0...4 { accumulator

    += i } print(accumulator) var accumulator = 0 for i in 0..<5 { accumulator += i } print(accumulator)
  4. var accumulator = 0 for i in 0..<5 { accumulator

    += i } print(accumulator) accumulator = 0 for i in range(0, 5) { accumulator += i } print(accumulator)
  5. I by Pat Hawks is licensed under a
 Creative Commons

    Attribution 4.0 International License Emoji provided free by Emoji One Some content from The Swift Programming Language by Apple Inc. I