SyntaxFix
Write A Post
Hire A Developer
Questions
Building up on Shavy Levy answer:
[bool]($var -as [int])
Because $null is evaluated to false (in bool), this statement Will give you true or false depending if the casting succeeds or not.