Swift - Basics and RuntimeWhich of the following is the correct syntax to declare a variable in Swift Playgrounds?Avariable name = "Alice"Bvar name = "Alice"Clet var name = "Alice"Ddeclare var name = "Alice"Check Answer
Step-by-Step SolutionSolution:Step 1: Recall Swift variable declaration syntaxSwift uses 'var' to declare variables and 'let' for constants, followed by the variable name and value.Step 2: Check each option for correct syntaxOnly 'var name = "Alice"' matches Swift syntax; others use invalid keywords.Final Answer:var name = "Alice" -> Option BQuick Check:Variable declaration syntax = var name = value [OK]Quick Trick: Use 'var' for variables and 'let' for constants [OK]Common Mistakes:Using 'variable' instead of 'var'Combining 'let' and 'var'Using 'declare' keyword
Master "Basics and Runtime" in Swift9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Swift Quizzes Collections - Array creation and type inference - Quiz 15hard Control Flow - Guard for early exit pattern - Quiz 11easy Control Flow - Switch must be exhaustive - Quiz 1easy Data Types - Type conversion is always explicit - Quiz 2easy Functions - Nested functions - Quiz 13medium Functions - Why functions are first-class in Swift - Quiz 14medium Functions - Functions returning tuples - Quiz 10hard Loops - For-in with where clause - Quiz 15hard Loops - Why Swift loops are safe by default - Quiz 5medium Loops - Break and continue behavior - Quiz 5medium