Skip to content

Instantly share code, notes, and snippets.

@suroegin
Last active July 7, 2017 12:32
Show Gist options
  • Save suroegin/e4b649501277586b1c694b4308ec529e to your computer and use it in GitHub Desktop.
Save suroegin/e4b649501277586b1c694b4308ec529e to your computer and use it in GitHub Desktop.

Scan Stdin data

Get data from keyboard in some methods.

Example 1

You can use bufio and NewScanner method.

input := bufio.NewScanner(os.Stdin)
for input.Scan() {
  ...
}

input.Scan() deletes \n in each lines, be careful.

Example 2

...

Имена

Ключевые слова

break case chan const continue
default defer else fallthrough for
func go goto if import
interface map package range return
select struct switch var type

Предопределенные имена

Константы:

  • true, false
  • iota
  • nil

Типы:

  • int, int8, int16, int32, int64
  • uint, uint8, uint16, uint32, uint64
  • float32, float64, complex128, complex 64
  • bool, byte, rune, string, error

Функции:

  • make, len, cap, new, append, copy, close, delete
  • complex, real, imag
  • panic, recover
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment