mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-12-23 09:41:36 +00:00
Adjusting last items before land
This commit is contained in:
parent
b46242c138
commit
d221d56c60
@ -51,7 +51,8 @@ Powershell as a Language:
|
|||||||
[int]-5 / [int]3 # => -1.66666666666667
|
[int]-5 / [int]3 # => -1.66666666666667
|
||||||
5.0 / 3.0 # => 1.66666666666667
|
5.0 / 3.0 # => 1.66666666666667
|
||||||
-5.0 / 3.0 # => -1.66666666666667
|
-5.0 / 3.0 # => -1.66666666666667
|
||||||
[int]$result = 5 / 3 # => 2
|
[int]$result = 5 / 3
|
||||||
|
$result # => 2
|
||||||
|
|
||||||
# Modulo operation
|
# Modulo operation
|
||||||
7 % 3 # => 1
|
7 % 3 # => 1
|
||||||
@ -716,8 +717,8 @@ C:\Program Files\dotnet\dotnet.exe # returns string rather than execute
|
|||||||
# One usage of '&' would be to invoke a scriptblock inside of your script.
|
# One usage of '&' would be to invoke a scriptblock inside of your script.
|
||||||
# Notice the variables are scoped
|
# Notice the variables are scoped
|
||||||
$i = 2
|
$i = 2
|
||||||
$scriptblock = { $i=5; Write-Output $i }
|
$scriptBlock = { $i=5; Write-Output $i }
|
||||||
& $scriptblock # => 5
|
& $scriptBlock # => 5
|
||||||
$i # => 2
|
$i # => 2
|
||||||
|
|
||||||
invoke-expression ' $i=5; Write-Output $i ' # => 5
|
invoke-expression ' $i=5; Write-Output $i ' # => 5
|
||||||
|
Loading…
Reference in New Issue
Block a user