Created
June 8, 2018 20:12
-
-
Save igoravl/e17b8423fedc48696c15a230715c3f4c to your computer and use it in GitHub Desktop.
Function ?? (IfNull)
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
Function Get-IfNull($Value, $DefaultValue) | |
{ | |
if($Value -eq $null) | |
{ | |
return $DefaultValue | |
} | |
return $Value | |
} | |
Set-Alias '??' Get-IfNull | |
# $a = $null | |
# $b = 'default' | |
# | |
# echo (?? $a $b) // returns 'default' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment