Exponentiation
suggest changeIn Swift, we can exponentiate Double
s with the built-in pow()
method:
pow(BASE, EXPONENT)
In the code below, the base (5) is set to the power of the exponent (2) :
let number = pow(5.0, 2.0) // Equals 25
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents