Commit 9facf355 authored by Thanabodee Charoenpiriyakij's avatar Thanabodee Charoenpiriyakij Committed by Ian Lance Taylor

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: default avatarIan Lance Taylor <iant@golang.org>
parent f64c0b2a
......@@ -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 {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment