[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: How can we make lua better?
- From: crow <crow_64a@...>
- Date: Mon, 28 Feb 2005 15:05:05 -0000
David Olofson <david@olofson.net> wrote:
(27/02/2005 22:03)
>The tricky part is avoiding a dummy initialization before code like
>this:
> //y = 0; // No, thanks!
> if a
> y = 1;
> else
> y = 2;
>
David, did you mean 'No thanks' as in: not wanting the ugly extra assignment to zero?
In a case like this, I use this:
y = 2
if a then y = 1 end
Only two, no 'else' and no chance of a var depending on a conditional branch merely for its prior existence...