Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Basic General > Re: BBC and DEF...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 56 of 81 Topic 620 of 685
Post > Topic >>

Re: BBC and DEFINT etc [Was: Using GOTO]

by "Judson McClendon" <judmc@[EMAIL PROTECTED] > Sep 10, 2007 at 10:44 AM

<news@[EMAIL PROTECTED]
> wrote:
> "Judson McClendon" <ju...@[EMAIL PROTECTED]
> wrote:
>> One thing that surprised me is the behavior of FOR/NEXT, in always
making
>> one iteration, regardless of the initial loop variables. I don't recall
ever using
>> a BASIC, or any other language sup****ting FOR, with that behavior.
>
> On the contrary, my recollection is that it was the normal behaviour
> at the time BBC BASIC was specified.
>
>> It is very counter intuitive.
>
> I disagree.  I can see no reason to anticipate any particular
> behaviour when the initial conditions are meaningless.  A statement
> such as FOR i = 3 TO 2 doesn't imply that the loop should be skipped,
> it has no logical meaning at all.  'Intuitively' the situation should
> never be allowed to arise.

But the initial conditions aren't meangless, they're simply false. The
begin, end and step values can all be variables, determined at runtime.
They may very well be meangful and logically correct, based on the
particular process. Something similar to a Quicksort, perhaps.

> It is clear that a REPEAT..UNTIL (or DO..WHILE) loop performs the test
> at the end of the loop, and hence must execute the body of the loop at
> least once.  On the other hand a WHILE..ENDWHILE (WHILE..WEND) loop
> performs the test at the beginning, and may not execute the body of
> the loop at all.  FOR..NEXT is neither one nor the other, and I can't
> see why it should preferentially be placed in either category.

In "DO ... WHILE (condition)" the termination condition is located at the
bottom of the loop, and is tested at the bottom of the loop.

IN "WHILE (condition) ... ENDWHILE" the termination condition is
located at the top of the loop, and is tested at the top of the loop.

In "FOR n  = begin TO end (condition) [STEP step] ... NEXT n" the
termination condition is located at the top of the loop, and should be
tested at the top of the loop. I believe doing otherwise violates the
Rule (or Law or Principle) of Least Astonishment. :-)
-- 
Judson McClendon      judmc@[EMAIL PROTECTED]
 (remove zero)
Sun Valley Systems     http://sunvaley.com
"For God so loved the world that He gave His only begotten Son, that
whoever believes in Him should not perish but have everlasting life."
 




 81 Posts in Topic:
Using GOTO
ppnerkDELETETHIS@[EMAIL P  2007-09-06 14:29:31 
Re: Using GOTO
Happy Trails <nomail@[  2007-09-06 11:51:52 
Re: Using GOTO
spambait@[EMAIL PROTECTED  2007-09-06 17:12:09 
Re: Using GOTO
ppnerkDELETETHIS@[EMAIL P  2007-09-07 04:26:16 
Re: Using GOTO
Happy Trails <nomail@[  2007-09-11 11:45:38 
Re: Using GOTO
"JJ" <stacko  2007-09-11 19:59:44 
Re: Using GOTO
Happy Trails <nomail@[  2007-09-13 07:30:56 
Re: Using GOTO
"news@[EMAIL PROTECT  2007-09-06 09:08:11 
Re: Using GOTO
Happy Trails <nomail@[  2007-09-06 15:18:36 
Re: Using GOTO
Happy Trails <nomail@[  2007-09-06 15:53:00 
Re: Using GOTO
"Gordon Rahman"  2007-09-06 23:04:46 
Re: Using GOTO
"news@[EMAIL PROTECT  2007-09-06 14:29:10 
Re: Using GOTO
Happy Trails <nomail@[  2007-09-06 21:32:15 
Re: Using GOTO
Eric <englere_geo@[EMA  2007-09-06 14:33:28 
Re: Using GOTO
Bert Byfield <BertByfi  2007-09-07 01:49:49 
Re: Using GOTO
"Gordon Rahman"  2007-09-07 01:26:05 
Re: Using GOTO
"R.Nicholson" &  2007-09-06 17:02:47 
Re: Using GOTO
Happy Trails <nomail@[  2007-09-06 21:37:58 
Re: Using GOTO
Bert Byfield <BertByfi  2007-09-07 01:52:00 
Re: Using GOTO
"Judson McClendon&qu  2007-09-07 06:21:26 
Re: Using GOTO
"R.Nicholson" &  2007-09-06 17:22:42 
Re: Using GOTO
"news@[EMAIL PROTECT  2007-09-07 01:47:13 
Re: Using GOTO
"news@[EMAIL PROTECT  2007-09-07 01:50:34 
Re: Using GOTO
"Gordon Rahman"  2007-09-07 12:52:11 
Re: Using GOTO
"news@[EMAIL PROTECT  2007-09-07 07:27:26 
BBC and DEFINT etc [Was: Using GOTO]
ppnerkDELETETHIS@[EMAIL P  2007-09-08 13:58:42 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-08 09:20:47 
Re: BBC and DEFINT etc [Was: Using GOTO]
Happy Trails <nomail@[  2007-09-08 12:35:58 
Re: BBC and DEFINT etc [Was: Using GOTO]
ppnerkDELETETHIS@[EMAIL P  2007-09-15 11:29:36 
Re: BBC and DEFINT etc [Was: Using GOTO]
budgie <me@[EMAIL PROT  2007-09-16 13:41:32 
Re: BBC and DEFINT etc [Was: Using GOTO]
ppnerkDELETETHIS@[EMAIL P  2007-09-16 09:56:21 
Re: BBC and DEFINT etc [Was: Using GOTO]
Happy Trails <nomail@[  2007-09-08 12:35:58 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-08 09:20:47 
BBC and DEFINT etc [Was: Using GOTO]
ppnerkDELETETHIS@[EMAIL P  2007-09-08 13:58:42 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-08 09:14:03 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 07:59:48 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 07:59:48 
Re: BBC and DEFINT etc [Was: Using GOTO]
Derek <derekrss@[EMAIL  2007-09-08 23:44:55 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-09 02:57:07 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-09 07:14:46 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-09 07:14:46 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-09 08:43:28 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-09 11:28:45 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-09 14:24:47 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-09 14:21:39 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-09 16:44:45 
Re: BBC and DEFINT etc [Was: Using GOTO]
Happy Trails <nomail@[  2007-09-09 17:31:18 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-10 09:46:37 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-10 09:46:37 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-09 16:44:45 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-09 14:21:39 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-09 14:24:47 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-09 11:28:45 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-09 15:28:28 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-09 20:10:59 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-10 10:44:36 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Judson McClendon&qu  2007-09-10 10:44:36 
FOR NEXT behavior
"news@[EMAIL PROTECT  2007-09-10 01:40:46 
Re: FOR NEXT behavior
"JJ" <stacko  2007-09-10 14:04:09 
Re: FOR NEXT behavior
Fred McKenzie <fmmck@[  2007-09-10 14:51:40 
Re: FOR NEXT behavior
"JJ" <stacko  2007-09-10 14:04:09 
Re: FOR NEXT behavior
Fred McKenzie <fmmck@[  2007-09-10 14:51:40 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-10 05:14:37 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 14:17:55 
Re: BBC and DEFINT etc [Was: Using GOTO]
"JJ" <stacko  2007-09-10 20:08:48 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 15:44:28 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 15:53:08 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 15:53:08 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 15:44:28 
Re: BBC and DEFINT etc [Was: Using GOTO]
"Tom Lake" <  2007-09-10 14:17:55 
Re: FOR NEXT behavior
"news@[EMAIL PROTECT  2007-09-10 06:32:31 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-10 09:48:04 
Re: Using GOTO
"R.Nicholson" &  2007-09-12 00:36:03 
FOR NEXT behavior
"R.Nicholson" &  2007-09-13 19:08:27 
Re: FOR NEXT behavior
"Tom Lake" <  2007-09-14 00:06:07 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-08 09:14:03 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-09 02:57:07 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-09 08:43:28 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-09 15:28:28 
Re: FOR NEXT behavior
"news@[EMAIL PROTECT  2007-09-10 06:32:31 
Re: BBC and DEFINT etc [Was: Using GOTO]
"news@[EMAIL PROTECT  2007-09-10 09:48:04 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Oct 15 13:00:04 CDT 2008.