D
Dr John Stockton
JRS: In article <[email protected]>, dated Tue, 22 Nov
2005 06:35:36, seen in RobG
Well, the latter, whether right or wrong, is pretty inscrutable. OTOH I
much dislike anything resembling
if () return true ; else return false
and I'd prefer something like
function dec() { var OK = secret > 0
if (OK) secret--
return OK }
or
function dec() { var OK = secret > 0
secret -= OK
return OK }
function dec() { var OK = secret > 0
secret -= OK
return OK }
2005 06:35:36, seen in RobG
Interesting to note that Douglas Crockford in his article /Private
Members in JavaScript/ includes this:
function dec() {
if (secret > 0) {
secret -= 1;
return true;
} else {
return false;
}
}
which could be reduced to:
function dec() {return secret && secret--};
Well, the latter, whether right or wrong, is pretty inscrutable. OTOH I
much dislike anything resembling
if () return true ; else return false
and I'd prefer something like
function dec() { var OK = secret > 0
if (OK) secret--
return OK }
or
function dec() { var OK = secret > 0
secret -= OK
return OK }
function dec() { var OK = secret > 0
secret -= OK
return OK }