Logo

Programming-Idioms

History of Idiom 120 > diff from v27 to v28

Edit summary for version 28 by programming-idioms.org:
[Go] Octal: comment, demo

Version 27

2018-03-21, 21:32:03

Version 28

2018-06-24, 08:03:28

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Idiom #120 Read integer from stdin

Read an integer value from the standard input into variable n.

Imports
import "fmt"
Imports
import "fmt"
Code
fmt.Scan(&n)
Code
fmt.Scan(&n)
Comments bubble
Warning: if the input has a leading 0, it will be interpreted as octal!
Doc URL
https://golang.org/pkg/fmt/#Scan
Doc URL
https://golang.org/pkg/fmt/#Scan
Demo URL
https://play.golang.org/p/rrRFnmvOwq
Demo URL
https://play.golang.org/p/nhMp1C03vBN