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:
Rodolfo Rodriguez 2018-08-30 18:14:09 -06:00 committed by Ian Lance Taylor
parent 770e37d249
commit eeb2a11eea
1 changed files with 11 additions and 0 deletions

View File

@ -29,6 +29,17 @@ func ExampleSprintf() {
// 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() {
n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
if err != nil {