[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Or



Le 29 sept. 05, à 16:53, James Harkins a écrit :

if((a == 1) or: { "2nd test".postln; 0.5.coin}) { "true".postln } {
"false".postln };

(a == 0) is false, so we have to run the second test to get the result.

The second test has to be written as a function for short-circuiting to work.


I guess you mean "(a == 1) is false, so we have to run(...)"

Ok nice to understand more practically "or:" and "and:", thanks a lot.

It seems to work too, writing that same example that way, as with "&&" and "||" (the way I do until now):

if((a == 1) or: { "2nd test".postln; 0.5.coin}, { "true".postln }, {"false".postln });