MERGE (The GNU Fortran Compiler)

### 8.203 `MERGE` — Merge variables ¶

Synopsis:

  `RESULT = MERGE(TSOURCE, FSOURCE, MASK)`

Description:

  Select values from two arrays according to a logical mask. The result is equal to TSOURCE if MASK is `.TRUE.`, or equal to FSOURCE if it is `.FALSE.`.

Class:

  Elemental function

Arguments:

  TSOURCE | May be of any type.
  FSOURCE | Shall be of the same type and type parameters as TSOURCE.
  MASK | Shall be of type `LOGICAL`.

Return value:

  The result is of the same type and type parameters as TSOURCE.

Standard:

  Fortran 90 and later