|
| From: | John W. Eaton |
| Subject: | [Octave-bug-tracker] [bug #40392] function parameter not used in while loop correctly |
| Date: | Sun, 27 Oct 2013 23:55:48 +0000 |
| User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130810 Firefox/17.0 Iceweasel/17.0.8 |
Update of bug #40392 (project octave):
Item Group: Incorrect Result => None
Status: None => Invalid
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #7:
You are still modifying c inside the loop. You just happen to get the result
you expect with a lower value.
Think about a simpler loop:
x = 10
while (x < 15)
x = x + 10
end
x
The sequence of events here is
* set x to 10
* test whether x < 10; if not, then execute the loop.
* inside the loop, increment x by 10. Now x is 20.
* test whether x is < 10. It is not, so don't execute the loop.
The while loop condition doesn't prevent the value from becoming larger than
the limit if you increment the variable inside the loop.
I'm closing this report as invalid.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?40392>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
| [Prev in Thread] | Current Thread | [Next in Thread] |