Go Printing to Stdout and Stderr: Difference between revisions
Jump to navigation
Jump to search
Line 21: | Line 21: | ||
==Format Strings== | ==Format Strings== | ||
The format strings contain conversation characters (ex. <code%s</code>): | The format strings contain conversation characters (ex. <code>%s</code>): | ||
<syntaxhighlight lang='go'> | <syntaxhighlight lang='go'> | ||
fmt.Printf("Hello %s", "Bob") | fmt.Printf("Hello %s", "Bob") | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 00:18, 19 August 2023
Internal
Bootstrapping Functions
Both print()
and println()
are pre-declared functions, ready to use without any import.
print()
println()
func main() {
println("something")
}
fmt.Printf()
import "fmt"
// ...
fmt.Printf("something")
Format Strings
The format strings contain conversation characters (ex. %s
):
fmt.Printf("Hello %s", "Bob")