FAQ: Difference between revisions

Jump to navigation Jump to search
46 bytes added ,  9 December 2011
Line 575: Line 575:
===Short-circuit <tt>&</tt> and <tt>|</tt> operators===
===Short-circuit <tt>&</tt> and <tt>|</tt> operators===


The <tt>&</tt> and <tt>|</tt> operators in Matlab short-circuit when included in an if statement and not otherwise. In Octave only the <tt>&&</tt> and <tt>||</tt> short circuit. Note that this means that
The <tt>&</tt> and <tt>|</tt> operators in Matlab short-circuit when included in a condition (e.g. an <tt>if</tt> or <tt>while</tt> statement) and not otherwise. In Octave only the <tt>&&</tt> and <tt>||</tt> short circuit. Note that this means that


             if (a | b)
             if (a | b)

Navigation menu