#498 While loop example incorrect

closed-fixed
nobody
5
2010-10-18
2010-08-28
Al Williams
No

http://freemat.sourceforge.net/help/flow_while.html

Here is a while loop that adds the integers from 1 to 100:
--> accum = 0;
--> k=1;
--> while (k<100), accum = accum + k; k = k + 1; end
--> accum

ans =
4950

>>> This actually adds the numbers 1 to 99. Unless, of course, you mean [1,99) but that's not really clear. Suggest either changing the example or wording it as adds the integers from 1 up to (but not including) 100.

Discussion

  • Samit Basu
    Samit Basu
    2010-10-18

    Fixed in rev 4056.

     
  • Samit Basu
    Samit Basu
    2010-10-18

    • status: open --> closed-fixed