MathGroup Archive 2010

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

Search the Archive

Difference between ; and , in for loop


Hi Mathematica Group,

Would anyone explain me the difference between ; and , in conditional
loop like for loop?
For example,

1) For[i = 1, i < 2, i++; Print[i]]
Answer is 2

But

2)  For[i = 1, i < 2, i++, Print[i]]
The Answer is 1

Why does first loop get  2 instead of 1?

Thanks!





  • Prev by Date: How to Clear All Variables in Current Cell
  • Next by Date: Re: Mathematica 8: first impressions
  • Previous by thread: Re: How to Clear All Variables in Current Cell
  • Next by thread: Re: Difference between ; and , in for loop