mirror of https://github.com/golang/go.git
fmt: add Println example
Change-Id: Ifd509c0c6a6ea41094b6ae1f4931414325b152fd Reviewed-on: https://go-review.googlesource.com/132475 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
770e37d249
commit
eeb2a11eea
|
|
@ -29,6 +29,17 @@ func ExampleSprintf() {
|
||||||
// 15
|
// 15
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ExamplePrintln() {
|
||||||
|
n, err := fmt.Println("there", "are", 99, "gophers")
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Print(n)
|
||||||
|
// Output:
|
||||||
|
// there are 99 gophers
|
||||||
|
// 21
|
||||||
|
}
|
||||||
|
|
||||||
func ExampleFprintln() {
|
func ExampleFprintln() {
|
||||||
n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
|
n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue