Complete the code to print a message without using a semicolon.
print("Hello, Swift")[1]
In Swift, semicolons are optional at the end of a line. You can leave it empty.
Complete the code to declare two variables on the same line using a semicolon.
var a = 5[1] var b = 10
When declaring multiple statements on the same line in Swift, you separate them with a semicolon.
Fix the error by adding or removing the semicolon correctly.
let x = 10[1] let y = 20
In Swift, semicolons are optional at the end of a line. Removing the semicolon here is correct.
Complete the code to write two print statements on the same line correctly.
print("Hello"); print("World")[1]
Use a semicolon to separate statements on the same line. The last statement does not need a semicolon.
Complete the code to declare three variables on the same line correctly.
var x = 1; var y = 2; var z = 3[1]
Use semicolons to separate multiple statements on the same line. The last statement does not need a semicolon.