left-to-right short-circuit conditional evaluation?
Posted: Thu Mar 09, 2006 6:13 pm
Is there a chance to use short-circuit (as in c and other prog langs) conditional evaluation in NEURON?
Take this example
oc> func a(){ print "a called" return 0}
oc> func b(){ print "b called" return 0}
oc> if( a() && b() ) print "none"
a called
b called
Once a() returned 0 there was no need to evaluate b().
Not only short-circuit evaluation is more efficient, but sometimes makes coding easier.
Take this example
oc> func a(){ print "a called" return 0}
oc> func b(){ print "b called" return 0}
oc> if( a() && b() ) print "none"
a called
b called
Once a() returned 0 there was no need to evaluate b().
Not only short-circuit evaluation is more efficient, but sometimes makes coding easier.