Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

"12" -eq 012 Why does it return $True

$
0
0

PS:\"12" -eq 012

True

May be I am missing something but my understanding is that the data type of left hand operand is forced on the right hand operand. So why should the above return True? My understanding was that internally the above evaluates as "12" -eq "012" (i.e. both string types). The string "12" is surely not equal to "012"?

Any idea?



Viewing all articles
Browse latest Browse all 21975


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>