Created
June 15, 2020 06:30
-
-
Save bugrym/151e7ea0a35dd28d1667b3a9fe5f7d4e to your computer and use it in GitHub Desktop.
Universal exponentiating method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func multiplicatorWith(base:Int, rate:Int) -> Int { | |
var initialValue = base | |
for _ in 1..<rate { | |
initialValue *= base | |
} | |
OR | |
for _ in 0..<(rate - 1) { | |
initialValue *= base | |
} | |
return initialValue | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment