Go Developer (Formatting Verbs for Printf())

0.0(0)
Studied by 1 person
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/9

flashcard set

Earn XP

Description and Tags

Step by step guide to becoming a Go developer in 2023

10 Terms

1
New cards

Go offers several formatting verbs that can be used with the ....... function.

Printf()

2
New cards

Prints the value in the default format

%v

3
New cards

Prints the value in Go-syntax format

%#v

4
New cards

Prints the type of the value

%T

5
New cards

Prints the % sign

%%

6
New cards

Verb %v:

Prints the value in the default format

7
New cards

Verb %#v:

Prints the value in Go-syntax format

8
New cards

Verb %T:

Prints the type of the value

9
New cards

Verb %%:

Prints the % sign

10
New cards

What is the output of this snippet?:

package main
import ("fmt")

func main() {
  var i = 15.5
  var txt = "Hello World!"

  fmt.Printf("%v\n", i)
  fmt.Printf("%#v\n", i)
  fmt.Printf("%v%%\n", i)
  fmt.Printf("%T\n", i)

  fmt.Printf("%v\n", txt)
  fmt.Printf("%#v\n", txt)
  fmt.Printf("%T\n", txt)
}

15.5
15.5
15.5%
float64
Hello World!
"Hello World!"
string