Semicolons in Swift
This tutorial is part of the Swift series.
In Swift, semicolons are optional. You can write statements on separate lines without needing to add a semicolon:
1 | let list = ["a", "b", "c"] |
Adding a semicolon in this case does not change anything:
1 | let list = ["a", "b", "c"]; |
However, if you want to write multiple statements on the same line, you must include a semicolon:
1 | var a = 2; let b = 3 |
tags: [“swift”, “semicolons”]