Complete the code to declare a variable with type inferred as Int.
var number = [1]The compiler infers the type of number as Int because the value 42 is an integer literal.
Complete the code to declare a constant with type inferred as Double.
let pi = [1]The compiler infers pi as Double because 3.14159 is a floating-point literal.
Fix the error in the code by completing the assignment with correct type inference.
var isActive = [1]The variable isActive is inferred as Bool when assigned the Boolean literal true.
Fill both blanks to create a dictionary with type inferred by the compiler.
let ages = [[1]: [2]]
The dictionary ages has keys of type String (like "Alice") and values of type Int (like 30), inferred by the compiler.
Fill all three blanks to filter the dictionary using a trailing closure with type inference and a condition.
let filteredAges = ages.filter { [1], [2] in [2] [3] 25 }This filter creates a dictionary with only entries where the age is greater than 25. The compiler infers the types from ages.