break from a block [send again]

E

Eva

Zmlyc3RseSBzb3JyeSBmb3IgbXkgYmFkIHdlYm1haWwgdXNlcmFnZW50LCBzbyBJIGhhdmUgdG8g
YmUgc2VuZGluZyBpdCBhZ2Fpbi4NCg0KDQpIb3cgdG8gYnJlYWsgYSBibG9jayB3aXRoIHN1Y2gg
dGhlIG1ldGhvZCBsaWtlIGVhY2g/DQpmb3IgZXhhbXBsZToNCg0KRmlsZS5uZXcoImJpZy50eHQi
KS5lYWNoIGRvIHxzfA0KICAgIGlmIHMgPX4gL2FiY2QvDQogICAgICAgcHV0cyBzDQogICAgICAg
YnJlYWsgICMgaXMgdGhpcyByaWdodD8NCiAgICBlbmQNCmVuZA0KDQoNClRoYW5rcyE=
 
N

Nathan Clark

2010/11/24 Eva said:
firstly sorry for my bad webmail useragent, so I have to be sending it ag= ain.


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

File.new("big.txt").each do |s|
=C2=A0 =C2=A0if s =3D~ /abcd/
=C2=A0 =C2=A0 =C2=A0 puts s
=C2=A0 =C2=A0 =C2=A0 break =C2=A0# is this right?
=C2=A0 =C2=A0end
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,141
Messages
2,570,818
Members
47,367
Latest member
mahdiharooniir

Latest Threads

Top