Created
March 31, 2016 20:55
-
-
Save Xainey/982591df56c84e683fef1f3c33ebbd29 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$Adder = { | |
param ([int] $x) | |
return ( | |
{ | |
param ([string] $y) | |
return ($x + $y) | |
}.GetNewClosure() | |
) | |
} | |
Set-Item -Path "Function:Adder" -Value $Adder | |
$add5 = Adder 5 | |
$add10 = Adder 10 | |
$add5.Invoke(2) | |
$add10.Invoke(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment