官术网_书友最值得收藏!

  • Go Systems Programming
  • Mihalis Tsoukalos
  • 120字
  • 2021-07-02 18:07:57

Printing output

The simplest way to print something in Go is using the fmt.Println() and fmt.Printf() functions. The fmt.Printf() function has many similarities with the C printf(3) function. You can also use the fmt.Print() function instead of fmt.Println().

The main difference between fmt.Print() and fmt.Println() is that the latter automatically prints a newline character each time you call it. The biggest difference between fmt.Println() and fmt.Printf() is that the latter requires a format specifier for everything it will print, just like the C printf(3) function. This means that you have better control over what you are doing, but you have to write more code. Go calls these specifiers verbs, and you can find out more about supported verbs at https://golang.org/pkg/fmt/.

主站蜘蛛池模板: 紫阳县| 伽师县| 左贡县| 垫江县| 柳林县| 石渠县| 黄山市| 广河县| 宣武区| 庆云县| 龙川县| 宝清县| 湟中县| 即墨市| 莆田市| 玉林市| 彝良县| 永嘉县| 湟源县| 高州市| 海阳市| 吉林市| 天台县| 崇文区| 得荣县| 利辛县| 集安市| 涞水县| 邯郸县| 嘉峪关市| 合川市| 闵行区| 无极县| 黄山市| 汉阴县| 光泽县| 庄浪县| 巨野县| 中超| 禹州市| 开远市|