Re: Optional "then" and "do"
Kat wrote:
>
> Larry Miller wrote:
> >
> > yuku wrote:
> > >
> > > I made changes to the parser.e so that the keyword "then" and "do"
> > > is optional (if the coder wants that it is still accepted).
> > >
> > > Reasons:
> > >
> > > - Less typing
> > >
> > > - Prevent mistakes of writing if <expr> do and for <expr> then
> > > which I did a lot of times (Kat too)
>
> Confirmed, especially when changing code from one loop form to another to get
> program flow to use exit correctly. I often wonder why "then" and "do" aren't
> the same word.
Me too. I think both 'do' and 'then' exist to mark the beginning of a executable
block of code. So, if they are synonyms, one of them is superfluous and could be
eliminated (in my opinion 'then').
A similar case occurs with '..' (slice operator) and 'to' (historical note: ZX81
BASIC uses 'TO' for 'FOR' statements and also for slices). Both have the meaning
of a range. In this case I would keep with '..'.
Then, we could write something like this:
for i = 1..10 do
if i=3 do exit end if
end for
[snipped]
Just some provocative thoughts!
- Fernando
|
Not Categorized, Please Help
|
|