How to use the original "break" in a loop when using pry-debugger

How can I use break in a loop using pry-debugger , which has a break function?

 10.times do |i| break if i > 2 end 

This code will fail with an ArgumentError: Cannot identify arguments as breakpoint error.

+6
source share
1 answer

Instead of break you can use break() . The brackets help the ruby ​​distinguish between the pry-debugger break and the ruby ​​break break() function. Then your code will look like this:

 10.times do |i| break() if i > 2 end 
+5
source

Source: https://habr.com/ru/post/982921/


All Articles