ADVERTISEMENT
ADVERTISEMENT

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

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!



ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT

Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates

© https://www.includehelp.com some rights reserved.