MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: in a loop

On 8/14/2010 6:34 AM, Bill Rowe wrote:
> For loops return Null. So, unless you specifically arrange for
> an output by using Print or something equivalent, no output is
> ever returned by a For loop.
> That is
> For[i = 0, i<  5, i++; i]
> will return nothing for exactly the same reason.
> One other observation, the listing created by
> dirnames = Names["$*Directory*"];
> For[i = 0, i<  Length[dirnames],i++; Print[dirnames[[i]]]]
> is more created by
> ColumnForm[Names["$*Directory*"]]
> or
> TableForm[Names["$*Directory*"]]
> which seems to me a simpler more direct approach than using
> Print in a For loop. These methods are also more efficient as
> there is no need to compute the number of items and increment an
> indexing variable.

Even simpler:


Ever since Grid and Column were introduced, I find no need for TableForm 

Helen Read
University of Vermont

  • Prev by Date: configuring the mathlink dev kit
  • Next by Date: Re: Repost - help with list manipulation
  • Previous by thread: configuring the mathlink dev kit
  • Next by thread: Re: in a loop