Bird
0
0

What is the main purpose of comments in Swift code?

easy📝 Conceptual Q11 of 15
Swift - Basics and Runtime
What is the main purpose of comments in Swift code?
ATo create new variables
BTo make the code run faster
CTo explain the code for better understanding
DTo store user data
Step-by-Step Solution
Solution:
  1. Step 1: Understand what comments do

    Comments are notes in the code that do not affect how the program runs but help explain what the code does.
  2. Step 2: Identify the purpose of comments

    Comments make the code easier to read and understand for yourself and others who read the code later.
  3. Final Answer:

    To explain the code for better understanding -> Option C
  4. Quick Check:

    Comments explain code [OK]
Quick Trick: Comments explain code, not run it or store data [OK]
Common Mistakes:
  • Thinking comments speed up code
  • Confusing comments with variables
  • Using comments to store data

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Swift Quizzes