Swift - Basics and RuntimeWhy is it important to use documentation markup comments (///) instead of regular comments for public Swift APIs?ABecause documentation comments generate API docs and improve code completionBBecause regular comments cause runtime errorsCBecause documentation comments execute fasterDBecause regular comments are ignored by the compilerCheck Answer
Step-by-Step SolutionSolution:Step 1: Understand the role of documentation commentsDocumentation comments (///) are used to generate external API documentation and provide rich code completion info.Step 2: Eliminate incorrect optionsRegular comments do not cause errors or affect execution speed; they are ignored by the compiler.Final Answer:Because documentation comments generate API docs and improve code completion -> Option AQuick Check:Documentation comments enhance API docs and IDE support [OK]Quick Trick: Use /// for public APIs to generate docs and help users [OK]Common Mistakes:Thinking regular comments cause errorsBelieving documentation comments affect runtime speedIgnoring benefits of documentation comments
Master "Basics and Runtime" in Swift9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Swift Quizzes Collections - Why collections are value types in Swift - Quiz 15hard Control Flow - If and if-else statements - Quiz 15hard Data Types - Why Swift is strongly typed - Quiz 9hard Loops - Repeat-while loop - Quiz 3easy Operators and Expressions - Comparison operators - Quiz 13medium Operators and Expressions - Arithmetic operators and overflow - Quiz 6medium Operators and Expressions - Range operators (... and ..<) - Quiz 1easy Optionals - Multiple optional binding - Quiz 14medium Variables and Constants - Type aliases for readability - Quiz 1easy Variables and Constants - Semicolons are optional behavior - Quiz 12easy