SwSwift · Lesson 1 of 8
Hello, Swift
Clean syntax, strong types, no semicolons. Swift reads like pseudocode but compiles to machine code as fast as C++ in many benchmarks.
Types are inferred but static: let name = "Ada" is a String forever. Explicit annotations use a colon — let name: String = "Ada". As in Kotlin and Rust, prefer immutable (let) and reach for var only when mutation is the point.
◆ Note
Int("123") returns Int? — an optional — because the string might not be a number. Swift makes every 'this could fail' visible in the type. That question mark is the heart of the language, and the next lesson.
Int("123") returns Int? — an optional — because the string might not be a number. Swift makes every 'this could fail' visible in the type. That question mark is the heart of the language, and the next lesson.