Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to start a debugging session using pry.
Ruby
require 'pry' x = 10 binding.[1] puts x
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'binding.start' instead of 'binding.pry'.
Forgetting to require 'pry' at the top.
✗ Incorrect
To start a debugging session with pry, use binding.pry.
2fill in blank
mediumComplete the code to start a debugging session using byebug.
Ruby
require 'byebug' x = 5 [1] puts x
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'binding.byebug' which is not correct syntax.
Forgetting to require 'byebug' at the top.
✗ Incorrect
To start a debugging session with byebug, just call byebug where you want to pause.
3fill in blank
hardFix the error in the code to correctly start a pry debugging session.
Ruby
require 'pry' x = 7 binding.[1]() puts x
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses with a wrong method name.
Using 'binding.debug' which does not exist.
✗ Incorrect
The correct method to call is binding.pry. It can be called with or without parentheses.
4fill in blank
hardFill both blanks to start a byebug session and assign a variable.
Ruby
require 'byebug' [1] = 20 [2] puts value
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'value' as variable but printing 'val'.
Calling 'debugger' instead of 'byebug'.
✗ Incorrect
Assign the number 20 to val and call byebug to start debugging.
5fill in blank
hardFill all three blanks to start a pry session, assign a variable, and print it.
Ruby
require 'pry' [1] = 15 binding.[2] puts [3]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between variable name and printed variable.
Using wrong method name after binding.
✗ Incorrect
Assign 15 to num, start pry with binding.pry, and print num.