Re: Print in a loop
- To: mathgroup at smc.vnet.net
- Subject: [mg103201] Re: Print in a loop
- From: pfalloon <pfalloon at gmail.com>
- Date: Thu, 10 Sep 2009 07:22:09 -0400 (EDT)
- References: <h87pef$5fv$1@smc.vnet.net>
On Sep 9, 6:36 pm, Luiz Melo <luiz.m... at polymtl.ca> wrote:
> The loop
>
> Do[Print[i],{i,3}]
>
> results in:
>
> 1
> then
> 1
> 2
> then
> 1
> 2
> 3
>
> How can we obtain:
> 1
> then
> 2
> then
> 3
>
> thanks
> Luiz
>
> --
I don't really get what you mean here. The loop prints out i for each
value, which results in 3 output cells containing "1", "2" and "3"
respectively. Perhaps you would like each cell to disappear when the
next one appears? If so, you may find PrintTemporary useful (possibly
together with Pause unless there is some slow-running code in the
loop).
Cheers,
Peter.