• This project
    • Loading...
  • Sign in

윤준석 / open-source-gitbranch-assignment2

%ea%b7%b8%eb%a6%bc1
Go to a project
Toggle navigation Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • Snippets
  • Network
  • Create a new issue
  • Builds
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Network
  • Compare
  • Branches
  • Tags
Switch branch/tag
  • open-source-gitbranch-assignment2
  • main.go
  • 윤준석's avatar
    ADD: implements exit function · 5e9919ac
    5e9919ac
    윤준석 authored 2022-03-26 21:13:27 +0900
main.go 299 Bytes
Raw Blame History Permalink
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
package main

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

func main() {
	var input string
	sc := bufio.NewScanner(os.Stdin)
	for {
		fmt.Print("input: ")
		sc.Scan()
		input = sc.Text()

		exit(input)

		fmt.Printf("output: %s\n", input)
	}
}

func exit(input string) {
	if input == "exit" {
		os.Exit(0)
	}
}