Board Thread:Watercooler/@comment-5590118-20150701035141/@comment-24473195-20150702224833

DarthKitty wrote:

The first is longer, but a lot easier to read IMO; the second is based on PEP 8, and is more compact.
 * -|Regular indentation=
 * -|Pythonic=

A couple of other questions:

I prefer the pythonic too, no need to senselessly add so many lines.
 * How do you guys feel about using the short-circuit  and   operators to emulate the   operator?
 * Should we encourage single-quotes, double-quotes, or let devs use whatever?

1) As for the short-circuit, I think it is better to let them use whatever. I doubt too many people understand how it works well enough to use it properly.

2) Both quotes are equally important, I'd much rather not waste time writing things such as :

local abc = "abc=\"zzz\" ddd"

Rather than simply using:

local abc = "abc='zzz' ddd"

@Shining-Armor, I think that's actually a good example as to why the ternary operator should not be used. The end result will be exactly the same, whether "and true or false" is included.

-- Name name = "Frank" -- Look at this function is_name_valid1(name) return string.len(name) > 0 end

-- vs function is_name_valid1(name) local bValidName = string.len(name) > 0 return bValidName end -- vs with if-then-else-end function is_name_valid2(name) if (string.len(name) > 0) then return true else return false end end -- test at http://www.lua.org/demo.html print(is_name_valid1(name)) print(is_name_valid2(name))