Help us understand the problem. What is going on with this article?

Go言語で標準入力

More than 1 year has passed since last update.

Go言語で標準入力

一回だけ受け取る↓

package main
import (
   "fmt"
   "os"
   "bufio"
)

func main() {
  stdin := bufio.NewScanner(os.Stdin)
  stdin.Scan()
  text := stdin.Text()
}

↓永久に受け取り続ける

package main
import (
   "fmt"
   "os"
   "bufio"
)

func main() {
  stdin := bufio.NewScanner(os.Stdin)
  for stdin.Scan(){
    text := stdin.Text()

  }
}

ちなみにRubyならこう

gets()
kosukeKK
Rubyを書いてます。 最近はAWSでAPI立てて、適当にクライアント作って遊んでます。
lifull
日本最大級の不動産・住宅情報サイト「LIFULL HOME'S」を始め、人々の生活に寄り添う様々な情報サービス事業を展開しています。
https://lifull.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away