Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@igoravl
Created June 8, 2018 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save igoravl/e17b8423fedc48696c15a230715c3f4c to your computer and use it in GitHub Desktop.
Save igoravl/e17b8423fedc48696c15a230715c3f4c to your computer and use it in GitHub Desktop.
Function ?? (IfNull)
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