From: Mohammad Khan Date: 2004-11-13T05:18:48+09:00 Subject: Re: array.each restart when array is changed On Fri, 2004-11-12 at 15:03, Kevin Bæ—¦rgens wrote: > Hi! > > >I would just do ('a' .. 'z').to_a.first(gets.to_i) > Call me stupid, but I don't find this function in the ruby book > > HAND, > Kevin what function? you might mean #.. in that case see 'Ranges' and 'Ranges as Sequences' topics at: http://www.rubycentral.com/book/tut_stdtypes.html below example might help you to understand better: [mkhan@localhost bin]$ irb irb(main):001:0> ('a' .. 'z') => "a".."z" irb(main):002:0> ('a' .. 'z').to_a => ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] irb(main):003:0> ('a' .. 'z').to_a.first => "a" irb(main):010:0> ('a' .. 'z').to_a.first(gets.to_i) 5 => ["a", "b", "c", "d", "e"] irb(main):010:0> ('a' .. 'z').to_a.first(gets.to_i) 3 => ["a", "b", "c"] irb(main):011:0> Thanks Mohammad -- [mkhan@localhost local]$ rm -Rf /bin/laden