Bird
0
0

What is the main purpose of comments in Ruby code?

easy📝 Conceptual Q1 of 15
Ruby - Basics and Runtime
What is the main purpose of comments in Ruby code?
ATo create variables automatically
BTo explain the code to humans reading it
CTo store data inside the program
DTo make the code run faster
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of comments

    Comments are notes in the code meant for people, not the computer.
  2. Step 2: Identify the correct purpose

    Comments help explain what the code does, making it easier to understand.
  3. Final Answer:

    To explain the code to humans reading it -> Option B
  4. Quick Check:

    Purpose of comments = Explain code [OK]
Quick Trick: Comments explain code to people, not machines [OK]
Common Mistakes:
  • Thinking comments affect program speed
  • Using comments to store data
  • Confusing comments with code

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes