golang 预定义标识符

Predeclared IdentifiersTypeExplanation
nilZero valueType must be a pointer, channel, func, interface, map, or slice type
iotaConstant计数器
falseConstant布尔值 false
trueConstant布尔值 true
append(slice []Type, elems …Type) []TypefunctionAppends the elements to the slice.
cap(v Type) intfunctionReturns the capacity of the slice.
clear[T ~[]Type | ~map[Type]Type1](t T)functionClears the contents of a map or slice.
close(c chan<- Type)functionCloses the channel.
complex(r, i FloatType) ComplexTypefunctionCreates a complex number with the given real and imaginary parts.
copy(dst, src []Type) intfunctionCopies elements from the source slice to the destination slice.
delete(m map[Type]Type1, key Type)functionDeletes the element with the given key from the map.
imag(c ComplexType) FloatTypefunctionReturns the imaginary part of the complex number.
len(v Type) intfunctionReturns the length of the slice, string, or map.
make(t Type, size …IntegerType) TypefunctionCreates a slice, map, or channel.
max[T cmp.Ordered](x T, y …T) TfunctionReturns the maximum of the given elements.
[min[T cmp.Ordered](x T, y …T) T]functionReturns the minimum of the given elements.
new(Type) *TypefunctionAllocates memory for a new value of the given type and returns a pointer to it.
panic(v any)functionStops the execution of the current goroutine and starts a panic.
print(args …Type)functionPrints the given arguments to the standard output.
println(args …Type)functionPrints the given arguments to the standard output, followed by a newline character.
real(c ComplexType) FloatTypefunctionReturns the real part of the complex number.
recover() anyfunctionAttempts to recover from a panic started by the current goroutine.
anytypeRepresents any type.
booltypeRepresents a boolean value (true or false).
bytetypeRepresents an 8-bit unsigned integer.
comparabletypeRepresents a type that can be compared using the == and != operators.
complex64typeRepresents a 64-bit complex number.
complex128typeRepresents a 128-bit complex number.
errortypeRepresents an error value.
float32typeRepresents a 32-bit floating-point number.
float64typeRepresents a 64-bit floating-point number.
inttypeRepresents an integer number.
int8typeRepresents an 8-bit signed integer.
int16typeRepresents a 16-bit signed integer.
int32typeRepresents a 32-bit signed integer.
int64typeRepresents a 64-bit signed integer.
runetypeRepresents a Unicode character.
stringtypeRepresents a sequence of characters.
uinttypeRepresents an unsigned integer number.
uint8typeRepresents an 8-bit unsigned integer.
uint16typeRepresents a 16-bit unsigned integer.
uint32typeRepresents a 32-bit unsigned integer.
uint64typeRepresents a 64-bit unsigned integer.
uintptrtypeRepresents an unsigned integer that represents a memory address.

References

Licensed under CC BY-NC-SA 4.0