VOOZH about

URL: https://www.geeksforgeeks.org/go-language/fmt-print-function-in-golang-with-examples/

⇱ fmt.print() Function in Golang With Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

fmt.print() Function in Golang With Examples

Last Updated : 5 May, 2020
In Go language, fmt package implements formatted I/O with functions analogous to C's printf() and scanf() function. The fmt.print() function in Go language formats using the default formats for its operands and writes to standard output. Here Spaces are added between operands when any string is not used as a parameter. Moreover, this function is defined under the fmt package. Here, you need to import the "fmt" package in order to use these functions. Syntax:
func Print(a ...interface{}) (n int, err error)
Here, "a ...interface{}" containing some strings and declared constant variables. Return Value: It returns the number of bytes written and any write error encountered. Example 1: Output:
GeeksforGeeks is a CS portal.
Example 2: Output:
abc
In the above code, the constant variables used are strings hence spaces are not added in between two strings shown above in the output. Example 3: Output:
5 15 15
In the above code, the constant variables used are numbers hence spaces are added in between two numbers shown above in the output.
Comment
Article Tags:

Explore