Function definition: Difference between revisions

Content added Content deleted
Line 210: Line 210:


=={{header|Groovy}}==
=={{header|Groovy}}==
<lang groovy>def multiply = { x, y -> x * y }</lang>

Test Program:
<lang groovy>println "x * y = 20 * 50 = ${multiply 20, 50}"</lang>

Output:
<pre>x * y = 20 * 50 = 1000</pre>

=={{header|Haskell}}==
=={{header|Haskell}}==
multiply = (*)
multiply = (*)