Skip to content

Commit

Permalink
fmt: add an example for Sprintln
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
drewvanstone authored and bradfitz committed Aug 31, 2018
1 parent 677c4ac commit 58e970e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/fmt/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 58e970e

Please sign in to comment.