help-octave
[Top][All Lists]
Advanced

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

Re: Suggestion: add do-enddo(condition)


From: Francesco Potorti`
Subject: Re: Suggestion: add do-enddo(condition)
Date: Fri, 28 Jan 2000 11:36:21 +0100 (CET)

Sorry, my previous message was somehow garbled.

John Eaton wrote:
     1.      do ... enddo (condition)
     2.      do ... while (condition)
     3.      do ... until (condition)
     4.  repeat ... until (condition)
     5.  repeat ... while (condition)

I  don't like  `while', because  of possible  (certain)  confusion while
reading  sources, as  you  have observed,  so  2 and  5  are ruled  out.
However, I  like a positive test  (while) much more than  a negative one
(until),  because in  the case  of `until'  we would  have two  kinds of
loops:

while () ... endwhile
do/repeat ... until ()

which are different in two orthogonal ways:
- test made at beginning/end
- positive/negative test

I think it is better to have  only a single difference.  I see this as a
simplicity issue in the definition of the language.

Moreover, the  `do/repeat ... until()'  construct is different  from all
other loops, which can be ended with and end* keyword.

I propose the following, that should address these two issues:

   do ... enddo while (condition)

or alternatively

   repeat ... endrepeat while (condition)

Obviously this means  that we need two keywords to  end the loop: `enddo
while'  or `endrepeat  while', and  this is  not nice,  but at  least it
does address the two above issues.

-- 
Francesco Potortì (researcher)         Voice:    +39-050-593 203 (op. 211)
Computer Networks Group                Fax:      +39-050-904052
CNUCE-CNR, Via Santa Maria 36          Email:    address@hidden
56126 Pisa - Italy                     Web:      http://fly.cnuce.cnr.it/



-----------------------------------------------------------------------
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
-----------------------------------------------------------------------



reply via email to

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