Last active
August 29, 2015 13:57
-
-
Save dmalikov/9916744 to your computer and use it in GitHub Desktop.
powershell wow so pure very functional
This file contains hidden or 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
$ cat function.ps1 | |
function f() { | |
{ param($x) "expected output" }.Invoke() | |
} | |
function g() { | |
{ param($x) "unexpected" }.Invoke() | |
return "output" | |
} | |
Write-Host (f).GetType() | |
Write-Host (g).GetType() | |
$ powershell ./function.ps1 | |
System.String | |
System.Object[] |
This file contains hidden or 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
$ cat function.ps1 | |
function func() { | |
{ param($x) "un" }.Invoke() | |
$res = "expected" | |
Write-Host $res | |
return $res | |
} | |
Write-Host(func) | |
$ powershell ./function.ps1 | |
expected | |
un expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment