10 ^ 0 =

Am I going mad? I have the following code:


Debug.Print("10 ^ 0 = " + (10 ^ 0));

which I expect to print out “10 ^ 0 = 1” but instead it prints out “10 ^ 0 = 10”

Why?

Ah, Is there an exponent operator in C#? - Stack Overflow, shows how rarely I raise something to a power. It’s


System.Math.Pow(10, 0)

1 Like

^ is the exclusive OR operator…

1 Like

Nbuch once gave me a nice tip for times like this… Just claim there was alcehol involved. :wink:

3 Likes

Sadly not enough alcohol, lack of sleep though ;-(