N
Navindra Umanee
Hi,
I have a question about The Ruby Way. Pickaxe gives the following
example for using iterators in Ruby:
a = [ "a", "b", "c" ]
a.each {|x| print x, " -- " }
This outputs:
a -- b -- c --
But what if I want to print "a -- b -- c"? What's the proper Ruby way
of doing that? Is there some way of detecting the last element? I
mean, obviously I can do it with a for/while loop or something...
Thanks,
Navin.
I have a question about The Ruby Way. Pickaxe gives the following
example for using iterators in Ruby:
a = [ "a", "b", "c" ]
a.each {|x| print x, " -- " }
This outputs:
a -- b -- c --
But what if I want to print "a -- b -- c"? What's the proper Ruby way
of doing that? Is there some way of detecting the last element? I
mean, obviously I can do it with a for/while loop or something...
Thanks,
Navin.