[futurebasic] Re: unhappy with loops

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : December 1997 : Group Archive : Group : All Groups

From: Chris.Young@...
Date: Tue, 2 Dec 1997 10:07:43 -0600
Waverly wrote:

>I find nothing wrong with FB's implementation of the for loop.  If this were 
>"C" it would be a different story.  A for loop is based on the 
>implementation on a loop based on an initiating expression, an ending 
>expression and the conditional use of a STEP clause.  By definition the 
>initiating expression exists causing the loop to executed atleast once.
>
>EX:
>
>WINDOW 1
>
>FOR loop = 12 TO 11
>  PRINT "this is a test"
>  PRINT loop
>NEXT
>
>DO
>  HANDLEEVENTS
>UNTIL 0
>
>
>With this example, even though the step value is not negative one, loop 
>initially equalled 12 and is executed one time.  I dont know the ANSI 
>definition for a FOR loop but I would bet that is not only within standard 
>but is the correct implementation.  If we were looking at a FOR loop in C 
>then the loop would not execute unless the {condition} were true.

In ANSI C, the content code in a For loop will not execute if the condition 
is not true.

>
>I also see nothing wrong with LONG IF.  Every version of BASIC I've seen has 
>it own dialectical spin.  In all honesty, it took me a bit of getting used 
>to but that was just a bump in the learning curve.  If you want to test 
>multiple conditions your could always use the SELECT statement.  It's not as 
>pretty but just as effective.
>
>If you want an easier conversion of other languages such as C to FB(III) 
>then its reasonable and desirable.  It just sounds more like you have a 
>gripe than a suggestion.
>
>

Unfortunately, while the above regarding syntactical variance between various 
Basic implementations is correct, adherence to (uggghhh) Microsoft 
implementations would probably not be a bad thing, specifically regarding the 
block style LONG IF...XELSE...END IF statement. Of particular usefulness would 
be the addition of the ELSE IF  to the FB syntax, thus preventing the
need for:

LONG IF (thisCondition)
.
XELSE
    LONG IF (thatCondition)
    .
    XELSE
    .
    END IF
END IF

instead being represented by

IF (thisCondition)
.
ELSE IF (thatCondition)
.
ELSE
.
END IF

Chris

(please excuse my email system if you get stray characters, etc.--corporate 
ccMail on a Windoze NT system)

Attachments: