×

Go Tutorial

Go Basics

Go Variables

Go Literals

Go Type Handling

Go Operators

Go Decision Making

Go Loops

Go Functions

Go String

Go Arrays

Go Slices

Go Maps

Golang Reference

Golang Programs

Golang Practice

Golang Miscellaneous

Golang print() Function with Examples

Golang | print() Function: Here, we are going to learn about the built-in print() function with its usages, syntax, and examples.
Submitted by IncludeHelp, on October 20, 2021 [Last updated : March 15, 2023]

print() Function

In the Go programming language, the print() is a built-in function that is used to format the given arguments in an implementation-specific way and writes the result to standard error. The print() function is useful for bootstrapping and debugging purposes; it is not guaranteed to stay in the language.

It accepts one or more parameters (args ...Type) and returns nothing.

Syntax

func print(args ...Type)

Parameter(s)

  • args… : One or more parameters to print.

Return Value

The return type of the print() function is none.

Example 1

// Golang program to demonstrate the
// example of print() function

package main

// Main Function
func main() {
	var i, j string = "Hello", "World"

	print("This is an example of 'print()'...\n")
	print(i)
	print(j)
}

Output

This is an example of 'print()'...
HelloWorld

Example 2

// Golang program to demonstrate the
// example of print() function

package main

// Main Function
func main() {
	name := "Alex"
	age := 21
	print(name, " age is ", age)
}

Output

Alex age is 21

Golang builtin Package »



Advertisement
Advertisement


Comments and Discussions!

Load comments ↻


Advertisement
Advertisement
Advertisement

Copyright © 2025 www.includehelp.com. All rights reserved.