init]; [description appendFormat:@"%@ is %i years old.", person.name, person.age]; if (person.employer) { [description appendFormat:@" They work for %@.", person.employer]; } else { [description appendString:@" They are unemployed."]; }
" = "love" let # = "Swift" let $ = ! + " " + " + " " + # + "!" println($) // We love Swift! let cat: Character = "%" println("This is a cat -> \(cat)") for characters in "&&&&&" { println(character) }
(statusCode: 200, description: "OK") ...and then do this println("The status code is \(http200Status.statusCode)") println("The status message is \(http200Status.description)")
about types - You must declare a function to take parameters of certain type ▸ Sometimes you have a functionality that is the same for multiple different types
store reference to any constants and variables from the context in which they are defined ▸ Functions are actually special cases of closures ▸ Expressions - unnamed closures
Swift article"); } else if ([person.name isEqualToString:@"Ray Wenderlich"]) { NSLog(@"Has a great website"); } else if ([person.name isEqualToString:@"Tim Cook"]) { NSLog(@"CEO of Apple Inc."); } else { NSLog(@"Someone else); }
interesting Swift article") case "Ray Wenderlich": println("Has a great website") case "Tim Cook": println("CEO of Apple Inc.") default: println("Someone else") }
for your Swift code ▸ Let's you try out some features/code snippets and get quick feedback without requiring you to compile and run a project ▸ Evaluates your code as you type it
an interactive toplevel or language shell, is a simple, interactive computer programming environment that takes single user inputs (i.e. single expressions), evaluates them, and returns the result to the user; a program written in a REPL environment is executed piecewise. — Wikipedia