Go Package fmt: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:


=Functions=
=Functions=
 
==<tt>fmt.Printf()</tt>, <tt>fmt.Println()</tt>==
* <tt>[https://golang.org/pkg/fmt/#Println fmt.Println()]</tt>
 
==<tt>fmt.Printf()</tt>==
{{Internal|Go_Printing_to_Stdout_and_Stderr#fmt.Printf.28.29|<tt>fmt.Printf()</tt>}}
{{Internal|Go_Printing_to_Stdout_and_Stderr#fmt.Printf.28.29|<tt>fmt.Printf()</tt>}}


==<tt>fmt.Scanf()</tt>==
==<tt>fmt.Scanf()</tt>, <tt>fmt.Scanln()</tt>==
 
{{Internal|Handling_stdin_in_Go#Handling_stdin_with_fmt_Functions|Handling <tt>stdin</tt> in Go}}
* <tt>[https://golang.org/pkg/fmt/#Scanf fmt.Scanf()]</tt>
 
==<tt>fmt.Scanln()</tt>==
 
* <tt>[https://golang.org/pkg/fmt/#Scanln fmt.Scanln()]</tt>
 
<pre>
var line string
fmt.Scanln(&line)
</pre>
 
==<tt>fmt.Errorf()</tt>==
==<tt>fmt.Errorf()</tt>==
* <tt>[https://golang.org/pkg/fmt/#Errorf fmt.Errorf()]</tt>
* <tt>[https://golang.org/pkg/fmt/#Errorf fmt.Errorf()]</tt>


<tt>Errorf</tt> formats according to a format specifier and returns the string as a value that satisfies <tt>error</tt>. For more on error handling see [[Go_Concepts_-_Error_Handling#Creating_Custom_error_Instances|error handling]].
<tt>Errorf</tt> formats according to a format specifier and returns the string as a value that satisfies <tt>error</tt>. For more on error handling see [[Go_Concepts_-_Error_Handling#Creating_Custom_error_Instances|error handling]].

Revision as of 01:52, 23 August 2023

External

Internal

Functions

fmt.Printf(), fmt.Println()

fmt.Printf()

fmt.Scanf(), fmt.Scanln()

Handling stdin in Go

fmt.Errorf()

Errorf formats according to a format specifier and returns the string as a value that satisfies error. For more on error handling see error handling.