Standard library / fmt

fmt.Print()

Writes default-formatted arguments to stdout; spaces are inserted only between adjacent operands when neither is a string. Returns bytes written and write error. Expected stdout: 'items=3\n7 <nil>\n'.

Formal Syntax & Structure

go syntaxgo
func Print(a ...any) (n int, err error)

Parameters & Attributes

NameTypeDescription
a...anyValues consumed by formatting; may be empty.

Return Value

(n int, err error)

Number of bytes written and write error.

Working Example

Example Snippetgo
package main
import (  "fmt")
func main() {  n, e := fmt.Print("items=", 3)  fmt.Println()  fmt.Println(n, e)}
Go Reference