Go Package fmt: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 8: Line 8:
=Functions=
=Functions=
==<tt>Sprintf()</tt>==
==<tt>Sprintf()</tt>==
Format a string and returns it as a result:
<syntaxhighlight lang='go'>
message := fmt.Sprintf("Hi, %v. Welcome!", name)
</syntaxhighlight>
==<span id='fmt.Printf.28.29.2C_fmt.Println.28.29'></span><tt>Printf()</tt>, <tt>Println()</tt>==
==<span id='fmt.Printf.28.29.2C_fmt.Println.28.29'></span><tt>Printf()</tt>, <tt>Println()</tt>==
{{Internal|Go_Printing_to_Stdout_and_Stderr#fmt_Functions|Printing to <tt>stdout</tt> and <tt>stderr</tt>}}
{{Internal|Go_Printing_to_Stdout_and_Stderr#fmt_Functions|Printing to <tt>stdout</tt> and <tt>stderr</tt>}}

Revision as of 00:13, 16 September 2023

External

Internal

Functions

Sprintf()

Format a string and returns it as a result:

message := fmt.Sprintf("Hi, %v. Welcome!", name)

Printf(), Println()

Printing to stdout and stderr

Scanf(), Scanln()

Handling stdin in Go

Errorf()

Error Handling | Wrapping Errors