Reputation: 15141
How can I use break
in a loop while using pry-debugger
that has break
function?
10.times do |i|
break if i > 2
end
This code will fail with error ArgumentError: Cannot identify arguments as breakpoint
.
Upvotes: 8
Views: 364
Reputation: 642
Instead of using break
, you could use break()
. The parenthesis will help ruby distinguish between pry-debugger's break
, and the ruby break()
function. Your code would then look like this:
10.times do |i|
break() if i > 2
end
Upvotes: 9