Complete the code to declare an implicitly unwrapped optional integer variable.
var number: Int[1]In Swift, an implicitly unwrapped optional is declared using an exclamation mark ! after the type.
Complete the code to assign a value to an implicitly unwrapped optional string.
var name: String! = [1]You assign a string value using quotes. Here, "Alice" is a valid string.
Fix the error in the code by completing the declaration of an implicitly unwrapped optional boolean.
var isActive: Bool[1] = trueThe exclamation mark ! declares an implicitly unwrapped optional in Swift.
Fill both blanks to unwrap and print the implicitly unwrapped optional safely.
if let unwrapped = optionalString[1] { print(unwrapped[2]) }
No additional symbols are needed. The if let statement safely unwraps the implicitly unwrapped optional. Inside the block, unwrapped is already unwrapped, so no extra symbol is needed to print it.
Fill all three blanks to declare, assign, and print an implicitly unwrapped optional integer.
var score[1]: Int score = [2] print(score[3])
Declare the variable as an implicitly unwrapped optional with !. Assign a value like 42. When printing, use ! to unwrap the value.