How can I return something early from a block?
- by ryeguy
If I wanted to do something like this:
collection.each do |i|
return nil if i == 3
..many lines of code here..
end
How would I get that effect? I know I could just wrap everything inside the block in a big if statement, but I'd like to avoid the nesting if possible.