Recall & Review
beginner
What does
fmt.Print do in Go?fmt.Print prints text to the standard output (usually the screen) without adding a new line at the end.
Click to reveal answer
beginner
How is
fmt.Print different from fmt.Println?fmt.Print prints text as is, while fmt.Println adds a new line after printing.
Click to reveal answer
beginner
Write a simple Go code snippet using
fmt.Print to print "Hello, Go!".<pre>package main
import "fmt"
func main() {
fmt.Print("Hello, Go!")
}</pre>Click to reveal answer
intermediate
Can
fmt.Print print multiple values? How?Yes, you can pass multiple values separated by commas. fmt.Print prints them without adding spaces.
Click to reveal answer
beginner
What will be the output of this code?<br>
fmt.Print("Go", "Lang")The output will be GoLang because fmt.Print prints multiple values without adding spaces.
Click to reveal answer
What does
fmt.Print("Hi") do?✗ Incorrect
fmt.Print prints text without adding a new line.
Which function adds a new line after printing in Go?
✗ Incorrect
fmt.Println prints text and adds a new line at the end.
What will
fmt.Print("Go", "Lang") output?✗ Incorrect
Multiple values are printed without spaces, so output is 'GoLang'.
How do you print a number and a string together using
fmt.Print?✗ Incorrect
Use commas to print multiple values: fmt.Print(5, " apples").
Which package must you import to use
fmt.Print?✗ Incorrect
The fmt package provides printing functions like Print.
Explain how
fmt.Print works and how it differs from fmt.Println.Think about what happens after the text is printed.
You got /4 concepts.
Write a Go program snippet that prints your name and age using
fmt.Print.Use commas to separate values inside fmt.Print.
You got /4 concepts.