GO語言"fmt"包中"Print"函數的用法及代碼示例。
用法:
func Print(a ...any)(n int, err error)
使用其操作數的默認格式打印格式並寫入標準輸出。當兩者都不是字符串時,在操作數之間添加空格。它返回寫入的字節數和遇到的任何寫入錯誤。
例子:
package main
import (
"fmt"
)
func main() {
const name, age = "Kim", 22
fmt.Print(name, " is ", age, " years old.\n")
// It is conventional not to worry about any
// error returned by Print.
}
輸出:
Kim is 22 years old.
相關用法
- GO Printf用法及代碼示例
- GO Println用法及代碼示例
- GO PutUvarint用法及代碼示例
- GO ParseAddress用法及代碼示例
- GO PlainAuth用法及代碼示例
- GO ParseUint用法及代碼示例
- GO ParseIP用法及代碼示例
- GO Pow10用法及代碼示例
- GO ParseMediaType用法及代碼示例
- GO ParseInt用法及代碼示例
- GO ParseCIDR用法及代碼示例
- GO PutVarint用法及代碼示例
- GO Perm用法及代碼示例
- GO Pipe用法及代碼示例
- GO ParseInLocation用法及代碼示例
- GO PathUnescape用法及代碼示例
- GO ParseDuration用法及代碼示例
- GO ParseFile用法及代碼示例
- GO Parse用法及代碼示例
- GO Pool用法及代碼示例
注:本文由純淨天空篩選整理自golang.google.cn大神的英文原創作品 Print。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。