lua-users home
lua-l archive

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

Is it still a requirement that the return statement is the last line in a
function? I know this conforms to
some coding styles but sometimes the ability to exit a function earlier on
would be very useful.

-----Original Message-----
From: Roberto Ierusalimschy []
Sent: 04 May 2000 14:02
To: Multiple recipients of list
Subject: Re: Lua 4.0 (alpha) now available 

> First you have to invent silly names (L1,L2,L3). Then you don't know where

> to write them (indented, left flushed, ...) and at last, if you see some 
> "break foo" you have to search for this damned label to see what loop you 
> leave. 

Most breaks break an inner loop, and then you do not need labels at all. If 
you really need a labeled break, 

1) just use "Loop" for the label (so you have a fixed silly name, and you 
do not need to invent them);

2) write it in a line by itself, starting in the first column (so you know 
where to write it).

Such label is quite visible, so that it is very easy to find the "damned 
label" ;-)

More seriously, multiple-level breaks are seldom used, so I think the real
question is whether to support them or not; the actual syntax is not that

-- Roberto