From help-octave-request at bevo dot che dot wisc dot edu Thu Jan 27 04:31:08 2000 Subject: Re: Suggestion: add do-enddo(condition) From: Thomas Walter To: jwe at bevo dot che dot wisc dot edu CC: help-octave at bevo dot che dot wisc dot edu Date: Thu, 27 Jan 2000 11:33:47 +0100 >>>>> "John" == John W Eaton writes: John> On 19-Oct-1999, Thomas Walter 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 (ftp://megrez.math.u-bordeaux.fr/pub/pari) , and the comercial package 'mupad'. Bye Thomas -- 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: walter at pctc dot chemie dot uni-erlangen dot de ----------------------------------------------------------------------- Octave is freely available under the terms of the GNU GPL. Octave's home on the web: http://www.che.wisc.edu/octave/octave.html How to fund new projects: http://www.che.wisc.edu/octave/funding.html Subscription information: http://www.che.wisc.edu/octave/archive.html -----------------------------------------------------------------------