Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: nesting while function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56799] Re: nesting while function
  • From: Peter Pein <petsie at dordos.net>
  • Date: Fri, 6 May 2005 03:00:17 -0400 (EDT)
  • References: <d5cst9$m3a$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

marloo3 at mail15.com wrote:
> Hi
> t = 0; i = 1; j = 1;
> While[i <= 3,

j=1;


>   While[j <= 2,
>     t = t + 1;
>     j = j + 1];
>   i = i + 1]
> 
> give the result for t=2 and not 6 as should be
> 
> but 
> t = 0; Do[
>          Do[
>              t = t + 1;
>               , {j, 2}];
>   , {i, 3}]
> 
> give the value of 6 for t
> is this a wrong behaviour for the "While" function ? or i miss something.
> thanks
> 
> 
> 
> 


-- 
Peter Pein
Berlin


  • Prev by Date: Re: how call a function by same name in 2 different contexts?
  • Next by Date: Re: ShadowPlot3D
  • Previous by thread: Re: nesting while function
  • Next by thread: Re: Re: nesting while function