Advertisement
Guest User

Untitled

a guest
Sep 4th, 2015
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. ################## PART ONE
  2. > ("a" + "b" * 3).length
  3. 4
  4. > ("a" + , "b" * 3).length
  5. 6
  6.  
  7. ################## PART TWO
  8. > if (2 > 1) { echo "two is larger than one" } else { echo "no it's not" }
  9. no it's not
  10.  
  11. ################## PART THREE
  12. > if ("this string contains letter A" -contains "A") { echo "yep" } else { echo "but actually it does't" }
  13. but actually it does't
  14.  
  15. ################## PART THREE
  16. $ cat test.ps1
  17. function add([int] $x, [int] $y) {
  18. return $x + $y
  19. }
  20.  
  21. Write-Host (add(1,2))
  22.  
  23. $ powershell ./test.ps1
  24. add : Cannot process argument transformation on parameter 'x'. Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".
  25. At test.ps1:5 char:16
  26. + Write-Host (add(1,2))
  27. + ~~~~~
  28. + CategoryInfo : InvalidData: (:) [add], ParameterBindingArgumentTransformationException
  29. + FullyQualifiedErrorId : ParameterArgumentTransformationError,add
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement