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 t
In this instance, you can use break to terminate the loop early:
collection.each do |i| break if i == 3 ...many lines end
...of course, this is assuming that you're not actually looking to return a value, just break out of the block.