Swift

Appeared in:
2014
Influenced by:
Paradigm:
Typing discipline:
File extensions:
swift
Programming language

Swift was introduced by Apple at WWDC 2014 for development on Mac OS X and iOS. It is available on Xcode 6.0+ for iOS and Xcode 6.1+ for Mac OS X.

Elements of syntax:

Inline comments //
Nestable comments /* ... */
Case-sensitivity Yes
Variable assignment <varname> = <value>
Variable declaration var <varname>
Variable declaration with assignment var <varname> = <value>
Grouping expressions ( )
Block { ... }
Physical (shallow) equality ===
Physical (shallow) inequality !==
Deep equality ==
Deep inequality !=
Comparison < > <= >=
Function definition func f(p1: type1, p2: type2, ...) -> returntype
Function call f(a, b, ...)
Function call with no parameters f()
Sequence ; OR newline
If - then if condition { ... }
If - then - else if condition { ... } else { ... } OR ( condition ? ... : ... )
Loop forever while true { ... }
While condition do while condition { ... }
Do until condition do { ... } while !condition
For each value in a numeric range, 1 increment for i = 1...10 { ... }
For each value in a numeric range, 1 decrement for i in stride(from: 10, through: 1, by: -1) { ... }