I'm doing a repeat structure in Ruby using the following structure:
begin
[código]
end <while/until> [condição]
But RuboCop , which I use as a linting tool, says that I should use Kernel#loop
with break
. So:
loop do
[código]
break <if/unless> [condição]
end
Why? In what cases should begin-end-while/until
be used? What are the advantages of Kernel#loop
above in relation to the structure I used?