<ELEMENTAL Example Program>

Program elemental_example
  Integer :: a(7) = [ 1, 0, 0, 2, 3, 0, 4 ]
  Where (a>0) a = f(a)
  Print *, a
Contains
  Elemental Integer Function f(i)
    Integer, Intent(In) :: i
    f = 2*i**2 - i**3 + i
  End Function
End Program

■ Execution Results

 2 0 0 2 -6 0 -28