Handling stdin in Go: Difference between revisions
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
=Internal= | =Internal= | ||
* [[Go_Code_Examples#Code_Examples|Go Code Examples]] | * [[Go_Code_Examples#Code_Examples|Go Code Examples]] | ||
* [[Go Strings]] | |||
=<tt>fmt.Scan()</tt>= | =<tt>fmt.Scan()</tt>= | ||
<syntaxhighlight lang='go'> | <syntaxhighlight lang='go'> |
Revision as of 01:35, 23 August 2023
Internal
fmt.Scan()
var s string
cnt, err := fmt.Scan(&s)
fmt.Printf("input line: %s, cnt: %d, error: %s\n", s, cnt, err)
fmt.Scanf()
var f float
cnt, err := fmt.Scanf("%f", &f)