Subject: Re: array.each restart when array is changed
From: Florian Gross <flgr ccan.de>
Date: Thu, 11 Nov 2004 22:38:29 +0900
References: 119799
In-reply-to: 119799
Kevin Böògens wrote:
> #show me the first n letters of the alphabet
> ('a'...'a'+gets.to_i).each{|e| puts e }
>
> How to do it the right way?
I would just do ('a' .. 'z').to_a.first(gets.to_i)