Welcome Guest. Please Login or Register. Apr 6th, 2018, 12:20am
ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018. Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.
If you require a dump of the post on your message board, please come to the support board and request it.
Re: FOR NEXT loop
« Reply #3 on: Jun 26th, 2013, 08:19am »
Thanks, that IS interesting. I'd also always assumed it went back to the FOR... statement, and had wondered, but never tested, whether the end condition was changeable.
I note that changing the control variable WILL alter the looping, though.
I note that changing the control variable WILL alter the looping, though.
Since BBC BASIC is interpreted there's no way it can tell that you've changed the value of the control variable 'behind its back'. Before the advent of EXIT FOR the standard way of prematurely exiting a FOR...NEXT loop was to set the loop variable to (or past) the limit value. Setting it past the limit value provided a convenient way of being able to test, on exit, whether it was terminated prematurely or not.