Your question is in two parts, firstly about the behavior of the statement, and then about whether you should do this; allow me to show you how many programmers would solve the second.
Imagine it's 4.30am on a Saturday morning and you're hung over and there is a bug in this code, and you need it fixed within the next 30 minutes or your job/business is at risk.
if (a ? b ? c : d : false)
or
if (a) {
if (b)
return c;
else
return d;
} else {
return false;
}
or
if (!a)
return false;
if (!b)
return d;
return c;
or
if (a)
return b ? c : d;
else
return false;
Which was the right choice?
-- edit --
With single letter variable names, it looks innocent enough. So, some real variable names:
if (application.config.usingUTCTimezone ? system.environment.biosTimezoneIsUTC ? haveNTPServerConfigured : system.time.clockIsSynchronized : false)
or
if (application.config.usingUTCTimezone ?
system.environment.biosTimezoneIsUTC ?
haveNTPServerConfigured : system.time.clockIsSynchronized
: false)
or
if (application.config.usingUTCTimezone) {
if (system.environment.biosTimezoneIsUTC)
return haveNTPServerConfigured;
else
return system.time.clockIsSynchronized;
} else {
return false;
}
or
if (!application.config.usingUTCTimezone)
return false;
if (!system.environment.biosTimezoneIsUTC)
return system.time.clockIsSynchronized;
return haveNTPServerConfigured;
or
if (application.config.usingUTCTimezone)
return system.environment.biosTimezoneIsUTC ? haveNTPServerConfigured : system.time.clockIsSynchronized;
else
return false;