0
0
Rubyprogramming~10 mins

Debugging with pry and byebug in Ruby - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete 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'
Astart
Bdebug
Cpry
Dsession
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'binding.start' instead of 'binding.pry'.
Forgetting to require 'pry' at the top.
2fill in blank
medium

Complete 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'
Adebugger
Bbinding.byebug
Cstart_debug
Dbyebug
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'binding.byebug' which is not correct syntax.
Forgetting to require 'byebug' at the top.
3fill in blank
hard

Fix 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'
Apry
Bstart
Cdebug
Dsession
Attempts:
3 left
💡 Hint
Common Mistakes
Using parentheses with a wrong method name.
Using 'binding.debug' which does not exist.
4fill in blank
hard

Fill 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'
Avalue
Bbyebug
Cval
Ddebugger
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'value' as variable but printing 'val'.
Calling 'debugger' instead of 'byebug'.
5fill in blank
hard

Fill 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'
Anum
Bpry
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Mismatch between variable name and printed variable.
Using wrong method name after binding.