Break from a block

firstly sorry for my bad webmail useragent, so I have to be sending it
again.

How to break a block with such the method like each?
for example:

File.new(“big.txt”).each do |s|
if s =~ /abcd/
puts s
break # is this right?
end
end

Thanks!

2010/11/24 Eva [email protected]:

end
end

Thanks!

Yes, that’s correct.

Try it with
“aaa\nbbb\nccc\nabcd\nddd\neee”.split(“\n”).each do |s|

if you want a quick test.