Go Printing to Stdout and Stderr: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 3: Line 3:
* [[Go Code Examples#Code_Examples|Go Code Examples]]
* [[Go Code Examples#Code_Examples|Go Code Examples]]
=Bootstrapping Functions=
=Bootstrapping Functions=
Both <code>print()</code> and <code>println()</code> are [Go_Language#Pre-Declared_Functions|pre-declared functions]], ready to use without any import.
==<tt>print()</tt>==
==<tt>print()</tt>==
==<tt>println()</tt>==
==<tt>println()</tt>==
<syntaxhighlight lang='go'>
<syntaxhighlight lang='go'>

Revision as of 00:13, 19 August 2023

Internal

Bootstrapping Functions

Both print() and println() are [Go_Language#Pre-Declared_Functions|pre-declared functions]], ready to use without any import.

print()

println()

func main() {
  println("something")
}

fmt.Printf()

import "fmt"

// ...
fmt.Printf("something")

Format Strings

fmt.Printf("Hello %s", "Bob")