If you keep type 'n',
you will be in the loop for 100 times,
How could I leave the each loop and continue to keep debugging from line 7 without exiting the loop then run the remain code automatically,
The behavior of exit
!!!
are not suit for me,
Because I want to keep debugging the code after I exit the loop.
1: require 'pry'
2:
=> 3: binding.pry
4: (1..100).each do |x|
5: print x
6: end
7:
8: print "hi"
Note: You must exit out of the current pry session by typing exit at the pry prompt and then re-run your file by entering ruby your_file_name. rb again in your terminal.
The Ruby programmer can invoke the pry console during runtime by inserting the line 'binding. pry' wherever they would like to stop the program. When the interpreter hits the binding. pry, Pry will open a REPL session in the console, allowing you to test variables, return values, iterations, and more.
you can use disable-pry
command
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With