Skip to content

Commit

Permalink
Merge pull request #755 from devlights/add-result-in-example
Browse files Browse the repository at this point in the history
  • Loading branch information
devlights authored Feb 19, 2024
2 parents 3c08df8 + eb48572 commit 98ed84f
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/basic/stdin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

このディレクトリには以下のサンプルがあります。

| file | example name | note |
|--------------------------|------------------------------|-----------------------------------------|
| read\_one\_input.go | stdin\_read\_one\_input | fmt.Scan() を利用して標準入力から一つの入力値を受け取るサンプルです |
| read\_multiple\_input.go | stdin\_read\_multiple\_input | fmt.Scan() を利用して標準入力から複数の入力値を受け取るサンプルです |
| file | example name | note |
| ---------------------- | ------------------------- | ------------------------------------------------------------------- |
| read_one_input.go | stdin_read_one_input | fmt.Scan() を利用して標準入力から一つの入力値を受け取るサンプルです |
| read_multiple_input.go | stdin_read_multiple_input | fmt.Scan() を利用して標準入力から複数の入力値を受け取るサンプルです |
18 changes: 18 additions & 0 deletions examples/basic/stdin/read_multiple_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,22 @@ func ReadMultipleInput() error {
output.Stdoutf("[fmt.Scan][02]", "messages=%v\n", messages)

return nil

/*
$ task
task: Task "build" is up to date
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: stdin_read_multiple_input
[Name] "stdin_read_multiple_input"
ENTER 3 WORDS: java dotnet golang
[fmt.Scan][01] messages=[java dotnet golang]
ENTER 3 WORDS: java dotnet golang
[fmt.Scan][02] messages=[java dotnet golang]
[Elapsed] 8.880712932s
*/

}
16 changes: 16 additions & 0 deletions examples/basic/stdin/read_one_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,20 @@ func ReadOneInput() error {
output.Stdoutf("[fmt.Scan]", "read-token-count=%d, message=%s\n", readTokenCount, message)

return nil

/*
$ task
task: Task "build" is up to date
task: [run] ./try-golang -onetime
ENTER EXAMPLE NAME: stdin_read_one_input
[Name] "stdin_read_one_input"
ENTER MESSAGE: helloworld
[fmt.Scan] read-token-count=1, message=helloworld
[Elapsed] 2.801315937s
*/

}

0 comments on commit 98ed84f

Please sign in to comment.