Recall & Review
beginner
What is the purpose of the
pry gem in Ruby?The
pry gem allows you to pause your Ruby program and open an interactive console to inspect variables, test code, and understand program flow.Click to reveal answer
beginner
How do you start a debugging session using
byebug in Ruby?Insert the line
byebug in your Ruby code where you want to pause execution. When the program runs and reaches this line, it opens a debugging console.Click to reveal answer
beginner
What command in
pry lets you continue program execution after pausing?Use the command
continue or exit in the pry console to resume running the program after inspection.Click to reveal answer
intermediate
Name one advantage of using
byebug over simple puts debugging.byebug lets you step through code line-by-line, inspect variables at any point, and control execution flow, which puts cannot do.Click to reveal answer
beginner
How do you install
pry and byebug gems for debugging?Add
gem 'pry' and gem 'byebug' to your Gemfile and run bundle install, or install directly with gem install pry byebug.Click to reveal answer
Which command starts an interactive debugging session with
byebug?✗ Incorrect
You start byebug debugging by inserting the line
byebug in your Ruby code.What does the
pry gem provide?✗ Incorrect
pry opens an interactive console during program execution for inspection and testing.Which command in
pry resumes program execution after pausing?✗ Incorrect
Typing
exit in the pry console continues running the program.What is a key benefit of using
byebug instead of puts for debugging?✗ Incorrect
byebug lets you pause and step through code, unlike puts which only prints output.How do you install
pry and byebug gems?✗ Incorrect
You add the gems to your Gemfile and run
bundle install to install.Explain how you would use
pry to debug a Ruby program.Think about where to put the pause and what happens next.
You got /5 concepts.
Describe the steps to start a debugging session with
byebug and how to control execution.Focus on how to pause and move through code.
You got /5 concepts.