Swift - LoopsWhich of the following is the correct syntax to label a loop named 'outerLoop' in Swift?Afor outerLoop in 1...3 { }BouterLoop: for i in 1...3 { }Cfor i in 1...3 outerLoop: { }Dlabel outerLoop for i in 1...3 { }Check Answer
Step-by-Step SolutionSolution:Step 1: Recall label syntax in SwiftLabels are written as a name followed by a colon before the loop statement.Step 2: Match syntax to optionsouterLoop: for i in 1...3 { } correctly places 'outerLoop:' before the for loop.Final Answer:outerLoop: for i in 1...3 { } -> Option BQuick Check:Label name + colon before loop = A [OK]Quick Trick: Label name ends with colon before loop starts [OK]Common Mistakes:Placing label after the loopUsing 'label' keyword (not valid)Putting label inside loop braces
Master "Loops" in Swift9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Swift Quizzes Collections - Array operations (append, insert, remove) - Quiz 8hard Collections - Dictionary creation and access - Quiz 2easy Functions - Variadic parameters - Quiz 6medium Functions - Argument labels and parameter names - Quiz 12easy Loops - Break and continue behavior - Quiz 6medium Loops - For-in with where clause - Quiz 2easy Operators and Expressions - Why operator safety matters in Swift - Quiz 2easy Optionals - Nil coalescing operator (??) - Quiz 3easy Swift Basics and Runtime - What is Swift - Quiz 11easy Variables and Constants - Type aliases for readability - Quiz 6medium