this.sides.px && buildPlane( 'z', 'y', 1 * flip, - 1, depth, height, - width_half, this.materials[ 0 ] ); // px
this.sides.nx && buildPlane( 'z', 'y', - 1 * flip, - 1, depth, height, width_half, this.materials[ 1 ] ); // nx
this.sides.py && buildPlane( 'x', 'z', 1 * flip, 1, width, depth, height_half, this.materials[ 2 ] ); // py
this.sides.ny && buildPlane( 'x', 'z', 1 * flip, - 1, width, depth, - height_half, this.materials[ 3 ] ); // ny
this.sides.pz && buildPlane( 'x', 'y', 1 * flip, - 1, width, height, depth_half, this.materials[ 4 ] ); // pz
this.sides.nz && buildPlane( 'x', 'y', - 1 * flip, - 1, width, height, - depth_half, this.materials[ 5 ] ); // nz
What does this boolean expression return? If it returns a boolean value, where does it go?
(I see no assignment!) How does it evaluate?
You are right that there is no assignment. These statements utilize the optimization used by the
&&operator. The&&operator evaluates to true if both the right hand and left hand sides evaluate to true. Thus, if the left hand side is false, it does not even have to check the right hand side, as the result will be false anyway, and it is not evaluated at all.Thus, this code:
is equivalent to this code: