Can I have a block in begin/while statement in Ruby?
- by jbjuly
I'm trying out to have a block in a while and begin statements in Ruby, but I get a syntax error. Any other way to implement it?
Here's what I want to accomplish
(1..limit).each { |i|
while (true) do |n|
x = n * (i%n)
puts n if n%i != 0
break if x.even? && !x.zero?
n += 1
end
}