lua-users home
lua-l archive

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


The problem is that the ternary operator's simplicity works against it
in some cases:

local a
local b
if predicate() then
  a = 1
  b = 2
else
  a = 'a'
  b = 'b'
end

local result = expensive_operation_returning_an_integer()
local a
if result < 5 then
  a = result -1
else
 a = result * 10
end

It ends up looking like bloat (sure, the nice kind of bloat one has
learned to like, but bloat nonetheless).