Skip to content

Commit 58e970e

Browse files
drewvanstonebradfitz
authored andcommitted
fmt: add an example for Sprintln
Change-Id: I0fcb5e626bf3d6891592c21b912c824743d7eaa0 Reviewed-on: https://go-review.googlesource.com/132280 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 677c4ac commit 58e970e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/fmt/example_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ func ExamplePrintln() {
4040
// 21
4141
}
4242

43+
func ExampleSprintln() {
44+
s := "Aug"
45+
sl := fmt.Sprintln("Today is 30", s)
46+
fmt.Printf("%q", sl)
47+
// Output:
48+
// "Today is 30 Aug\n"
49+
}
50+
4351
func ExampleFprintln() {
4452
n, err := fmt.Fprintln(os.Stdout, "there", "are", 99, "gophers")
4553
if err != nil {

0 commit comments

Comments
 (0)