Answer the question
In order to leave comments, you need to log in
How to raise to a power in Swift?
Help, please, I can not find a method that raises a variable with type Int to a power.
I draw special attention to the fact that the type Int, not Double (pow does not accept Int)
The only crutch found
var a = 2
var i = pow(Double(a),2)
BUT I'm interested without these crutches.
Answer the question
In order to leave comments, you need to log in
This is not a crutch, but the usual type casting that is characteristic of strongly typed languages. Everything is ok with your code
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question