-
-
Save dmalikov/10651508 to your computer and use it in GitHub Desktop.
Wow so null very static such empty
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
$ powershell ./wut.ps1 | |
String is null | |
String is null | |
String is empty |
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
function main() { | |
if ($true) { | |
$s = $null | |
} else { | |
$s = "string" | |
} | |
if ($s -eq $null) { Write-Host "String is null" } | |
if ($s -eq "") { Write-Host "String is empty" } | |
do_something_boring $s | |
} | |
function do_something_boring($s) { | |
if ($s -eq $null) { Write-Host "String is null" } | |
if ($s -eq "") { Write-Host "String is empty" } | |
do_something_obvious $s | |
} | |
function do_something_obvious([string] $s) { | |
if ($s -eq $null) { Write-Host "String is null" } | |
if ($s -eq "") { Write-Host "String is empty" } | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment