Is there no continue keyword for Ruby?
I created a code that just passes the number less than 2 out of the numbers from 0 to 5, but I'm embarrassed that there's no continue
here.
for i in 0..5
If i < 2 then #2 does not output less than 2
continue
end
puts "Value: #{i}"
end
`block in <main>': undefined local variable or method `continue' for main:Object (NameError)
from `each'
from `<main>'
Ruby writes next
instead of continue
.
for i in 0..5
if i < 2 then
Next # I changed it
end
puts "Value: #{i}"
end
© 2024 OneMinuteCode. All rights reserved.