github.com/mangodowner/go-gm@v0.0.0-20180818020936-8baa2bd4408c/src/math/example_test.go (about)

     1  // Copyright 2017 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package math_test
     6  
     7  import (
     8  	"fmt"
     9  	"math"
    10  )
    11  
    12  func ExampleSqrt() {
    13  	const (
    14  		a = 3
    15  		b = 4
    16  	)
    17  	c := math.Sqrt(a*a + b*b)
    18  	fmt.Printf("%.1f", c)
    19  	// Output: 5.0
    20  }