perhaps:
a.inject(false) do |skip, elt|
puts elt if !skip
elt==“b”
end
(no, I don’t think this is realy nice)
cheers
Simon
perhaps:
a.inject(false) do |skip, elt|
puts elt if !skip
elt==“b”
end
(no, I don’t think this is realy nice)
cheers
Simon
On Mon, 05 Dec 2005 15:13:46 +0100, Kroeger, Simon (ext)
[email protected] wrote:
(no, I don’t think this is realy nice)
Here is another (not really nice) way to do it, using the flip-flop
operator:
%w( a b c d b e ).each { |el| nil if (puts(el) || el == “b”)…true }
a
b
d
b
Dominik
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