Skip to content

Instantly share code, notes, and snippets.

@bugrym
Created June 15, 2020 06:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bugrym/151e7ea0a35dd28d1667b3a9fe5f7d4e to your computer and use it in GitHub Desktop.
Save bugrym/151e7ea0a35dd28d1667b3a9fe5f7d4e to your computer and use it in GitHub Desktop.
Universal exponentiating method
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