mirror of
https://github.com/golang/go
synced 2024-11-17 21:54:49 -07:00
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: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
parent
9facf35592
commit
b7182acf61
@ -49,6 +49,17 @@ func ExampleSprintf() {
|
||||
// 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() {
|
||||
n, err := fmt.Println("there", "are", 99, "gophers")
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user