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

fmt: add example for Print

Updates #27376

Change-Id: I2fa63b0d1981a419626072d985e6f3326f6013ff
Reviewed-on: https://go-review.googlesource.com/134035
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 9facf355
...@@ -49,6 +49,17 @@ func ExampleSprintf() { ...@@ -49,6 +49,17 @@ func ExampleSprintf() {
// 15 // 15
} }
func ExamplePrint() {
n, err := fmt.Print("there", "are", 99, "gophers", "\n")
if err != nil {
panic(err)
}
fmt.Print(n)
// Output:
// thereare99gophers
// 18
}
func ExamplePrintln() { func ExamplePrintln() {
n, err := fmt.Println("there", "are", 99, "gophers") n, err := fmt.Println("there", "are", 99, "gophers")
if err != nil { 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