[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Goto and return ('end' expected)
- From: Rena <hyperhacker@...>
- Date: Wed, 6 May 2015 13:10:43 -0400
On Wed, May 6, 2015 at 12:51 PM, Parke <parke.nexus@gmail.com> wrote:
> On Wed, May 6, 2015 at 9:22 AM, Hisham <h@hisham.hm> wrote:
>
>> The point is not how to workaround this. Aapo's question still stands.
>
> In other languages where return is a statement, when debugging I often
> insert returns mid-function to disable functionality. I assume the
> Lua requires return at the end of blocks to avoid confusion:
>
> function foo ()
> a ()
> b ()
> return
> c () -- foo will return c()
> d ()
> end
>
I use "do return end" for that. There's no confusion like in foo() and
it's clear what your intent is. Just having a naked "return" partway
through a block is not only possibly ambiguous, but often a sign that
something's been misplaced.
--
Sent from my Game Boy.