Function definition: Difference between revisions
Content added Content deleted
imported>Joeypas (Added section for ziglang) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
Line 3,491: | Line 3,491: | ||
The following 'multiply' function will work for any type(s) that support the '*' operator. |
The following 'multiply' function will work for any type(s) that support the '*' operator. |
||
However, it will produce a runtime error otherwise, as demonstrated by the final example. |
However, it will produce a runtime error otherwise, as demonstrated by the final example. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">var multiply = Fn.new { |a, b| a * b } |
||
System.print(multiply.call(3, 7)) |
System.print(multiply.call(3, 7)) |