Re: OT: The REAL RIddle of DO LOOPS Solved
- From: "Richard Atkins" <richard.atkins@xxxxxxxxxxx>
- Date: 26 May 2006 08:29:56 -0700
I assume you mean "decrement" or "STEP -1".No I did actually mean increment until the value reaches it's maximum
and then wraps round when it overflows (e.g. for an unsigned byte 255+1
= 0, for a 16 bit signed integer +32762+1 = -32763) and continues
incrementing until the target value is reached.
In fact that is my contention that any BASIC should KNOW in the
statement FOR n = A to B
whether the STEP is +1 or -1, without requiring the explicit
statement of STEP or STEP SGN(B-A).
I think we will have to agree to disagree. I think any BASIC should
KNOW in the statement FOR N = A TO B that if B<A and I haven't
explicitely told it how to step then I might have made a programming
error. Imagine the A and B concerned is counting a value that must
clearly increment, such as investment months in a loop generating
values that are a function of compound interest earnt.
I also stand by the more basic principle that programming languages are
there to allow me to instruct a computer to follow an unambiguous
sequence of operations. If there is any ambiguity in what should be
done then that's poor programming on my part and I would ideally want
the language to highlight my error rather than take a guess.
If BASIC did throw an error when Luis' program was given the sort of
values that kicked off this discussion then there would have been no
need for this thread. The program would have required modification to
cope with the additional possible inputs that (presumably) were not
considered by the original programmer and the code for the modified
program would have explicitely specified how such values should be
handled.
.
- Follow-Ups:
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- Re: OT: The REAL RIddle of DO LOOPS Solved
- References:
- OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Lou Thraki
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Richard Atkins
- Re: OT: The REAL RIddle of DO LOOPS Solved
- From: Reef Fish
- OT: The REAL RIddle of DO LOOPS Solved
- Prev by Date: Re: Hidden information question
- Next by Date: Chi-Squared Test (goodness of fit) confidence levels
- Previous by thread: Re: OT: The REAL RIddle of DO LOOPS Solved
- Next by thread: Re: OT: The REAL RIddle of DO LOOPS Solved
- Index(es):
Relevant Pages
|