Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to exit the loop in pry

Tags:

ruby

pry

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"
like image 897
newBike Avatar asked May 13 '14 04:05

newBike


People also ask

How do I get out of binding pry?

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.

How do you use pry in Ruby?

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.


1 Answers

you can use disable-pry command

like image 119
alchemist Avatar answered Sep 20 '22 18:09

alchemist