mirror of
https://github.com/golang/go
synced 2024-11-23 17:30:02 -07:00
fmt: add an example for Sprintln
Change-Id: I0fcb5e626bf3d6891592c21b912c824743d7eaa0 Reviewed-on: https://go-review.googlesource.com/132280 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
677c4acc98
commit
58e970ed79
@ -40,6 +40,14 @@ func ExamplePrintln() {
|
||||
// 21
|
||||
}
|
||||
|
||||
func ExampleSprintln() {
|
||||
s := "Aug"
|
||||
sl := fmt.Sprintln("Today is 30", s)
|
||||
fmt.Printf("%q", sl)
|
||||
// Output:
|
||||
// "Today is 30 Aug\n"
|
||||
}
|
||||
|
||||
func ExampleFprintln() {
|
||||
n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user