Last active
September 5, 2015 17:56
-
-
Save dmalikov/ab8089754ef86a72497a to your computer and use it in GitHub Desktop.
Meanwhile on the Planet of Adequate Programming Languages
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
################## PART ONE | |
> ("a" + "b" * 3).length | |
4 | |
> ("a" + , "b" * 3).length | |
6 | |
################## PART TWO | |
> if (2 > 1) { echo "two is larger than one" } else { echo "no it is not" } | |
no it is not | |
################## PART THREE | |
> if ("this string contains letter A" -contains "A") { echo "yep" } else { echo "but actually it does not" } | |
but actually it does not | |
################## PART FOUR | |
$ cat test.ps1 | |
function add([int] $x, [int] $y) { | |
return $x + $y | |
} | |
Write-Host (add(1,2)) | |
$ powershell ./test.ps1 | |
add : Cannot process argument transformation on parameter 'x'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32". | |
At test.ps1:5 char:16 | |
+ Write-Host (add(1,2)) | |
+ ~~~~~ | |
+ CategoryInfo : InvalidData: (:) [add], ParameterBindingArgumentTransformationException | |
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,add |
Thanks 👍
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
If you plan to use PowerShell, I would recommend spending some time learning it. Every language will break in amusing ways if you make assumptions, rather than learn the syntax.
No offense, even very bright folks like Helge Klein have made these assumptions.
Cheers!