Swift - Variables and ConstantsWhich of the following Swift statements is syntactically correct and uses type inference?Avar 2ndValue = 5Blet message: = "Hello"Cvar score = 100Dlet isReady = ?Check Answer
Step-by-Step SolutionSolution:Step 1: Check syntax correctnessvar score = 100 declares a variable with inferred Int type correctly.Step 2: Identify syntax errors in other optionslet message: = "Hello" has misplaced colon, var 2ndValue = 5 starts variable name with digit, let isReady = ? uses invalid assignment.Final Answer:var score = 100 -> Option CQuick Check:Correct syntax with type inference = var score = 100 [OK]Quick Trick: Variable names must start with letters; no misplaced colons [OK]Common Mistakes:Starting variable names with digitsMisplacing colons in declarationsUsing invalid assignment symbols
Master "Variables and Constants" in Swift9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Swift Quizzes Data Types - String is a value type behavior - Quiz 10hard Data Types - Int, Double, Float number types - Quiz 5medium Data Types - Bool type and logical operators - Quiz 12easy Data Types - Why Swift is strongly typed - Quiz 14medium Functions - Variadic parameters - Quiz 11easy Functions - Argument labels and parameter names - Quiz 11easy Operators and Expressions - Comparison operators - Quiz 15hard Optionals - Multiple optional binding - Quiz 2easy Optionals - Optional binding with if let - Quiz 10hard Variables and Constants - Let for constants (immutable) - Quiz 11easy