On Mon, Aug 26, 2013 at 8:37 AM, Ben G. <lists / ruby-forum.com> wrote:


> The reason I am using an array is that sometimes I will need to generate
> a secondary file, based off of the same numbers. In the second file I
> will need to iterate over the array and concatenate additional numbers
> onto the front of each value within the array.
>

That is not a good reason IMHO.  Only if creating the sequence of numbers
was costly (i.e. involving expensive calculations) this would be a good
reason. OTOH if the range is potentially large you are burning a lot of
memory which might cause an issue. Whether that IS an issue for your use
case I cannot tell because there is a whole lot that we do not know about
your program. Generally you could assume though that the cost of IO
dominates the iteration - but that is just a rule of thumb.


> Sometimes that number begins with a 0, so I collect start_code with
>

I think I'd still rather use Fixnum for iterating the range and use a
proper String formatting (printf) on output to preserve the appropriate
number of leading zeros.

Kind regards

robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/