hallo again Timo,
na gut, Du hast ja recht. es liegt tatsaechlich auf der hand, dies zu tun.
... wenn man dann aber schon so weit ist, faellt mir auf und ein, das der
ganze kram konsequenterweise auch gleich mit einem vezicht auf benutzung
von »if ( .. ) { ... } else { ... } « umgesetzt werden sollte.
done:
also nochmal:
/*
[link:http://de.wikipedia.org/wiki/Smalltalk-80_(Programmiersprache)#IF-Anweisung]
*/
[link:http://www.pseliger.de/jsExtendedApi/jsApi.Boolean.ifTrue.ifFalse.dev.js@title=Boolean.prototype.ifTrue] = (function (fct, target/*optional:[object|function]*/) { // [caseTrue], [ifTrue], [ifTrueDo]
return (((this.valueOf() && (typeof fct == "function")) ? (function () {fct.call(((typeof target == "undefined") || ((typeof target == "obj") && !target)) ? (null) : (target)); return true;}) : (function () {return false;}))());
});
Boolean.prototype.ifFalse = (function (fct, target/*optional:[object|function]*/) { // [caseFalse], [ifFalse], [ifFalseDo]
return (((!this.valueOf() && (typeof fct == "function")) ? (function () {fct.call(((typeof target == "undefined") || ((typeof target == "obj") && !target)) ? (null) : (target)); return true;}) : (function () {return false;}))());
});
/*
[link:http://jconsole.com]
*/
(7 < 6).ifTrue(function () {
print(" ... is true.");
}).ifFalse(function () {
print(" ... is false.");
});
(7 > 6).ifTrue(function () {
print(" ... is true.");
}).ifFalse(function () {
print(" ... is false.");
});
so long - peterS. - pseliger@gmx.net
--
»Because objects in JavaScript are so flexible, you will want to think differently about class hierarchies.
Deep hierarchies are inappropriate. Shallow hierarchies are efficient and expressive.« - Douglas Crockford
ie:( fl:) br:> va:( ls:& fo:) rl:) n3;} n4:} ss:} de:µ js:} mo:? zu:]
»Because objects in JavaScript are so flexible, you will want to think differently about class hierarchies.
Deep hierarchies are inappropriate. Shallow hierarchies are efficient and expressive.« - Douglas Crockford
ie:( fl:) br:> va:( ls:& fo:) rl:) n3;} n4:} ss:} de:µ js:} mo:? zu:]