Function definition: Difference between revisions
Content added Content deleted
(→{{header|E}}: describe short function syntax) |
|||
Line 272: | Line 272: | ||
(Because of commutativity property of the multiplication, the difference between <code>multiply(x,y)</code> and <code>multiply(y,x)</code> is not evident) |
(Because of commutativity property of the multiplication, the difference between <code>multiply(x,y)</code> and <code>multiply(y,x)</code> is not evident) |
||
Also note that the function result can be declared with a different name within the routine: |
|||
<lang fortran>module elemFunc |
|||
contains |
|||
elemental function multiply(x, y) result(z) |
|||
real, intent(in) :: x, y |
|||
real :: z |
|||
z = x * y |
|||
end function multiply |
|||
end module elemFunc</lang> |
|||
=={{header|F Sharp|F#}}== |
=={{header|F Sharp|F#}}== |