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!
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
endThanks!
Yes, that’s correct.
Try it with
“aaa\nbbb\nccc\nabcd\nddd\neee”.split(“\n”).each do |s|
…
if you want a quick test.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs