I am confused about the Math.Pow() variable. I know it’s supposed to raise a number to the power of another number. But like, concretely I don’t get what that means or how it really works.
Hello! When you use Math.Pow()
, you pass in two double
s. The first one(x
) is the base, or the number you want to be raised. The second one(y
) is the power. It returns the first number raised to the second number (x**y
):
//I want to raise 4 to the 3rd power, and save it:
double someVar = Math.Pow(4, 3);
//someVar now stores the value 64, or 4**3 or 4^3
I hope this helps!
Thank you! That really helped!
1 Like