MERGE intrinsic function
Standard: F77 F90 F95 F2003
  Example Program
<Syntax>
MERGE ( TSOURCE, FSOURCE, MASK )

TSOURCE : any type;
FSOURCE : same type as TSOURCE;
MASK : Logical;

Result : same type as TSOURCE.
<Semantics>
Returns the value of TSOURCE if MASK is true, and FSOURCE otherwise. Like many intrinsic functions, this is elemental; if all arguments are scalar the result is scalar, if any argument is an array the other arguments must either be scalars or arrays with the same shape, and the result is an array of that shape with the operation being applied elementwise.

Note that both TSOURCE and FSOURCE may be evaluated before MASK is evaluated; if it is necessary to evaluate only the one selected by MASK, you must use an IF-THEN construct.
<Related>