lua-users home
lua-l archive

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


From: Sam Roberts
> I don't need the ternary as an operator, but I don't like code like:
> 
> function doit(switch)
>   	local x = "that"
> 	if switch then x = "this" end
> 	...
> 
> I'm a fan of single initialization.

Me too, but what's wrong with:

function doit( switch )
  local x = switch and "this" or "that"
  ...

?