“blue is the sky” … “the sky is blue” …
this is a very minor thing (and just when you thought there was nothing left worth nitpicking!!) but…
i’d like to suggest that Corona adopt a consistent style for writing conditional statements.
why? i think it would benefit the community, particularly beginners, if a standard were adopted.
I can offer up my own preference, but I don’t really care - either way, just pick one, and stick to it.
as a simple example, take the included “Composer” sample code:
in the scenetemplate.lua file (which matches docs) we find human style, fe:
if phase == "did" then
but in all of the actual scene files (scene1.lua et al) we find yoda style, fe:
if "did" == phase then
the open-source libraries are a hodge-podge, fe:
-- timer.lua -- yoda in performWithDelay(): "function" == type( listener.timer ) -- human in cancel() a few lines later: if type(entry) ~= "table" then
$0.02 section. My personal preference? Human-style always, yoda-style never. The only “real” argument in favor of yoda is in languages like C that support assignments within conditional expressions (and even there it’s of debatable value). Lua doesn’t even have that problem, so there’s really no argument in favor of yoda within this context.
fwiw