Function prototype: Difference between revisions
Content added Content deleted
(New post.) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
Line 1,773: | Line 1,773: | ||
In the following example, the 'factorial' function is recursive and so needs a forward declaration. However, even though the function takes a single argument, no prior information about that is needed or possible. There is an example of mutual recursion protoyping in the [[Mutual_recursion#Wren]] task. |
In the following example, the 'factorial' function is recursive and so needs a forward declaration. However, even though the function takes a single argument, no prior information about that is needed or possible. There is an example of mutual recursion protoyping in the [[Mutual_recursion#Wren]] task. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">var factorial // forward declaration |
||
factorial = Fn.new { |n| (n <= 1) ? 1 : factorial.call(n-1) * n } |
factorial = Fn.new { |n| (n <= 1) ? 1 : factorial.call(n-1) * n } |