Programare swift Swift tutorial from tutorials point | Page 5
Swift 4
Logical Operators .................................................................................................................................. 27
Bitwise Operators ................................................................................................................................. 28
Assignment Operators........................................................................................................................... 29
Range Operators ................................................................................................................................... 30
Misc Operators ...................................................................................................................................... 31
Operators Precedence ........................................................................................................................... 31
11. SWIFT 4 – DECISION MAKING ............................................................................................ 33
if Statement .......................................................................................................................................... 34
if-else Statement ................................................................................................................................... 35
if...else if...else Statement ..................................................................................................................... 36
Nested If Statements ............................................................................................................................. 38
Switch Statement .................................................................................................................................. 39
The ? : Operator .................................................................................................................................... 41
12. SWIFT 4 – LOOPS ............................................................................................................... 42
for-in Loop ............................................................................................................................................ 43
Swift 4 – while Loop .............................................................................................................................. 44
Swift 4 – repeat-while Loop .................................................................................................................. 45
Loop Control Statements....................................................................................................................... 47
Swift 4 – continue Statement ................................................................................................................ 47
Swift 4 – break Statement ..................................................................................................................... 49
Swift 4 – Fallthrough Statement ............................................................................................................ 50
13. SWIFT 4 – STRINGS ............................................................................................................ 53
Create a String ....................................................................................................................................... 53
Empty String .......................................................................................................................................... 53
String Constants .................................................................................................................................... 54
String Interpolation ............................................................................................................................... 55
iv