1
0
mirror of https://github.com/golang/go synced 2024-11-17 21:04:43 -07:00

fmt: add example for Fprint

Updates #27376

Change-Id: I0ceb672a9fcd7bbf491be1577d7f135ef35b2561
Reviewed-on: https://go-review.googlesource.com/133455
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:
Thanabodee Charoenpiriyakij 2018-09-05 13:40:29 +07:00 committed by Ian Lance Taylor
parent f64c0b2a28
commit 9facf35592

View File

@ -68,6 +68,17 @@ func ExampleSprintln() {
// "Today is 30 Aug\n"
}
func ExampleFprint() {
n, err := fmt.Fprint(os.Stdout, "there", "are", 99, "gophers", "\n")
if err != nil {
panic(err)
}
fmt.Print(n)
// Output:
// thereare99gophers
// 18
}
func ExampleFprintln() {
n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
if err != nil {