Skip to content

Instantly share code, notes, and snippets.

@bjartwolf
Created August 21, 2013 07:50
Show Gist options
  • Save bjartwolf/6291471 to your computer and use it in GitHub Desktop.
Save bjartwolf/6291471 to your computer and use it in GitHub Desktop.
Sane way to do absolute values of integers
func SaneAbs (num int) int {
if num > 0 {
return num
} else {
return -num
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment