Currying: Difference between revisions

GDScript
(Dialects of BASIC moved to the BASIC section.)
(GDScript)
Line 927:
 
In '''[https://formulae.org/?example=Currying this]''' page you can see the program(s) related to this task and their results.
 
=={{header|GDScript}}==
{{trans|Python}}
 
Uses Godot 4's lambdas. This runs as a script attached to a node.
<syntaxhighlight lang="gdscript">
extends Node
 
func addN(n: int) -> Callable:
return func(x):
return n + x
 
func _ready():
# Test currying
var add2 := addN(2)
print(add2.call(7))
 
get_tree().quit() # Exit
</syntaxhighlight>
 
=={{header|Go}}==
89

edits