lua-users home
lua-l archive

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


if we are talking readability, I'd also use more readable variable names

On Tue, Apr 13, 2010 at 1:06 AM, Quae Quack <quae@daurnimator.com> wrote:
>
> On 13 April 2010 06:58, Sam Roberts <vieuxtech@gmail.com> wrote:
>>
>> On Mon, Apr 12, 2010 at 1:55 PM, cynthia powers <powcyn@gmail.com> wrote:
>> > Hi,
>> >
>> > What's the easiest translation to convert the following c to lua? or do
>> > I
>> > have to make this into a if-else block.
>> >
>> > x = ((vXSTX > vXSX) || (vXSTX > vXSY)) ? (vXSX + vXSTX) : vXSX;
>>
>> x = ((vXSTX > vXSX) or (vXSTX > vXSY)) and (vXSX + vXSTX) or vXSX
>
> for the sake of readability I'd rather something like
> x = vXSX
> if (vXSTX > vXSX) or (vXSTX > vXSY) then
>     x = x + vXSTX
> end
>
> Daurn
>