Skip to content

Instantly share code, notes, and snippets.

@joanmolinas
Last active August 29, 2015 14:18
Show Gist options
  • Save joanmolinas/810849c2ed810275a3fc to your computer and use it in GitHub Desktop.
Save joanmolinas/810849c2ed810275a3fc to your computer and use it in GitHub Desktop.
infix operator ** { associativity left precedence 160 }
postfix operator ** {}
func ** (lhs: Double, rhs: Double) -> Double {
return pow(lhs, rhs)
}
postfix func **(rhs : Int) -> Int {
return rhs * rhs
}
2/4 ** -4 //OUTPUT -> 512.0
5** //OUTPUT -> 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment