Skip to content

Commit 9facf35

Browse files
wingyplusianlancetaylor
authored andcommitted
fmt: add example for Fprint
Updates #27376 Change-Id: I0ceb672a9fcd7bbf491be1577d7f135ef35b2561 Reviewed-on: https://go-review.googlesource.com/133455 Run-TryBot: Ian Lance Taylor <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]>
1 parent f64c0b2 commit 9facf35

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/fmt/example_test.go

+11
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,17 @@ func ExampleSprintln() {
6868
// "Today is 30 Aug\n"
6969
}
7070

71+
func ExampleFprint() {
72+
n, err := fmt.Fprint(os.Stdout, "there", "are", 99, "gophers", "\n")
73+
if err != nil {
74+
panic(err)
75+
}
76+
fmt.Print(n)
77+
// Output:
78+
// thereare99gophers
79+
// 18
80+
}
81+
7182
func ExampleFprintln() {
7283
n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
7384
if err != nil {

0 commit comments

Comments
 (0)