Conditional structures: Difference between revisions

m
copy edit - wiki link to wikipedia
m (copy edit - wiki link to wikipedia)
Line 946:
deusEx();
}</lang>
Java also supports [http[wp://en.wikipedia.org/wiki/Short-circuit_evaluation |short-circuit evaluation]]. So in a conditional like this:
<lang java>if(obj != null && obj.foo()){
aMethod();
Line 1,906:
results=dispatcher[x]()
 
This can be particularly handy when using [http[wp://en.wikipedia.org/wiki/Currying |currying]] techniques, or when lambda expressions or meta-function generators (factories) can be used in place of normal named functions.
 
In general a dispatch table or class/object abstraction (using dynamic method over-rides) is considered preferable to chains of ''if ... elif ... elif ...'' in Python programming.