[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Suggestion: add do-enddo(condition)

From: Thomas Walter
Subject: Re: Suggestion: add do-enddo(condition)
Date: Thu, 27 Jan 2000 11:33:47 +0100

>>>>> "John" == John W Eaton <address@hidden> writes:

    John> On 19-Oct-1999, Thomas Walter <address@hidden> wrote:
    John> | for some programing logic, I want to suggest to add a
    John> | 
    John> |   do
    John> |     ...
    John> |   enddo (CONDITION)
    John> | 
    John> | to the octave interpreter.
    John> | 
    John> | Pros and cons?

    John> Do you expect this to execute the loop as long as CONDITION is true,
    John> with a minimum of one trip through?  If so, then I think

Yes that's what I mean.

    John>   do
    John>   while (CONDITION)

    John> would make that intention clearer, but it might also make it hard to
    John> spot errors, since `while (CONDITION)' is already used to begin
    John> loops.  (I don't think this is such a problem for C since braces are
    John> used to delimit the body of the loop.)

And this is why I suggested 'do ... enddo' to avoid name colission.
On the other your naming is much clearer.  Can the parser work with
this collision?

The use for this kind of loop is I want to execute a block at least
once and then have a look at the conditions.  Using this it is much
simpler to write loops for fitting and similar things.

    John> I don't recall seeing any responses to this message, so maybe there
    John> are not very many people who have strong feelings about it one way or
    John> the other.  Is anyone else interested in having this construct
    John> available in Octave?

I have not seen a reply too.  But having both kinds of loops can make
the code much cleaner in some cases.  And the lack of any reply may
depend on other tools like the always referenced 'matlab' not having
this.  I do not know this package, only 'pari/gp' which comes with GPL
( , and the comercial
package 'mupad'.


SUSHI?  Nein, Danke.  Ich esse keine Köder.

Dipl. Phys. Thomas Walter
Inst. f. Physiklische Chemie II
Egerlandstr. 3                          Tel.: ++9131-85 27326 / 27330
91058 Erlangen, Germany                 email: address@hidden

Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]