I have the following code that initializes the value -1:
Set-Variable -Name ID -Value -1 -Scope local
When I do it like this
$local:ID++
I get the following error:
The operator "++" only works with numbers. The operand is 'System.String'.
I thought this would mean this as an int. But I have to use a workaround that is not neat:
Workaround:
$intVal = [int]$local:ID $intval ++
Is there any other approach?
source share