Function prototype: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(New post.)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
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.
<syntaxhighlight lang="ecmascriptwren">var factorial // forward declaration
 
factorial = Fn.new { |n| (n <= 1) ? 1 : factorial.call(n-1) * n }
9,476

edits