---
title: "Discussion on \"Go Cheatsheet - Get User Input from Stdin\" | Hashnode"
description: "Discussion on \"Go Cheatsheet - Get User Input from Stdin\". Get User Input from Stdin\nScanln & Scanf\nvar name string\nfmt.Scanln(&name)  // this will scan only one string token (if there is a space in your string)\n\nvar age int\nfmt.Scanf(\"%d\\n\", &age)\n\nbufio.NewScanner\nsc := bufio.NewScanner(os.Stdin)\nsc.Scan()..."
url: "https://hashnode.com/posts/go-cheatsheet-get-user-input-from-stdin/60807d2deb2bd30d2d22e187"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Go Cheatsheet - Get User Input from Stdin](https://hn.0xbf.me/go-cheatsheet-get-user-input-from-stdin?utm_source=hashnode&utm_medium=feed)

Get User Input from Stdin Scanln & Scanf var name string fmt.Scanln(&name) // this will scan only one string token (if there is a space in your string) var age int fmt.Scanf("%d\\n", &age) bufio.NewScanner sc := bufio.NewScanner(os.Stdin) sc.Scan()...

Apr 21, 2021 · 1 min read · hn.0xbf.me  
Read the article

-   [#go](https://hashnode.com/tag/go)

## Written by

[0xBF](https://hashnode.com/@0xbf)

@0xbf

  
[View profile](https://hashnode.com/@0xbf)

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
