Print Functions
sprintf(format, arguments…)
golang’s printf format
if format is not given, will default to string
printf(format, arguments…)
Uses the golang printf format. If the format is not given, it will default to string.
Format specifiers:
- %v : formats the value in a default format
- %d : formats decimal integers
- %f : formats the floating-point numbers
- %g : formats the floating-point numbers and removes trailing zeros=
- %b : formats base 2 numbers
- %o : formats base 8 numbers
- %t : formats true or false values
- %s : formats string values
printf("%d", 2) // prints 2 as a string to traces
printf(2) // ERROR: expected string but int64 given
printf("2") // prints the string 2 to traces
Updated 6 months ago