import "fmt" func main() { // using the default formats fmt.Println("Hello Mahmood") // return values from Println n, _ := fmt.Println("Hello Mahmood 2") // formats according to a format specifier fmt.Printf("Length : %d\n", n) isTrue := true aNumber := 1400 name := "Mahmood" // The verbs: // values in a default format fmt.Printf("Boolean : %v\n", isTrue) fmt.Printf("Number : %v\n", aNumber) fmt.Printf("String : %v\n", name) // values with specified format fmt.Printf("Boolean : %t\n", isTrue) fmt.Printf("Number : %d\n", aNumber) fmt.Printf("String : %s\n", name) // formats according to a format specifier and returns the resulting string myString := fmt.Sprintf("Hello %s", name) fmt.Println(myString) }
References
https://golang.org/pkg/fmt/