Use
Kernel#loop
with break
rather than begin/end/until
(or while
).10# Raises "`while`/`until` detected in `begin` block"
11begin
12 do_something
13end while a == b14
15# Raises "multiple comparison detected"
16x < y < z
Description
while
/until
should be used at the beginning of the block, and without the begin
statement.
Bad practice
begin
puts i
i += 1
end while i < 10
Recommended
while i < 10
puts i
i += 1
end