LoginSignup
1
0

More than 1 year has passed since last update.

Go 言語で無限ループしながら コンソールのユーザー入力を待ち受ける ( #Go wait user input in console with infinite loop )

Last updated at Posted at 2020-03-16

package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	for {
		fmt.Println("Enter some words!")
		input := bufio.NewScanner(os.Stdin)
		input.Scan()
		fmt.Println("input is " + input.Text())
	}
}

// Enter some words!
// A
// input is A
// Enter some words!
// B
// input is B
// Enter some words!
// C
// input is C
// Enter some words!

Original by Github issue

チャットメンバー募集

何か質問、悩み事、相談などあればLINEオープンチャットもご利用ください。

Twitter

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0