How can I unset variable? For example, PHP has an unset($var)
function.
There is no way to "clear" a variable. You can just overwrite it. If the PIN is wrong, input a new PIN, overwriting the old one.
The Remove-Variable cmdlet deletes a variable and its value from the scope in which it is defined, such as the current session. You cannot use this cmdlet to delete variables that are set as constants or those that are owned by the system.
To delete a variable from all sessions, add a Remove-Variable command to your PowerShell profile. You can also refer to Remove-Variable by its built-in alias, rv . For more information, see about_Aliases.
There is not really an equivalent to "unset".
The closest match I know is the use of the default keyword.
For example:
MyType myvar = default(MyType); string a = default(string);
The variable will still be "set", but it will have its default value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With