Skip to content

Instantly share code, notes, and snippets.

@bxcodec
Last active April 12, 2017 07:57
Show Gist options
  • Save bxcodec/e7bf8a3e088957a7c93f50f3240371af to your computer and use it in GitHub Desktop.
Save bxcodec/e7bf8a3e088957a7c93f50f3240371af to your computer and use it in GitHub Desktop.
Using math library
package main
import (
"fmt"
"math"
)
func main() {
x := -5
fmt.Println(math.Abs(float64(x))) // print : 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment