Skip to content

Commit d66b4e1

Browse files
committed
Add Result in examples
1 parent 433657a commit d66b4e1

File tree

4 files changed

+58
-0
lines changed

4 files changed

+58
-0
lines changed

examples/basic/scanop/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# サンプルリスト
2+
3+
このディレクトリには以下のサンプルがあります。
4+
5+
| file | example name | note |
6+
| ----------------------- | --------------------------- | ------------------------------------------------------- |
7+
| read_one_input.go | scanop_read_one_input | fmt.Scan() で一つの値を読み取るサンプルです. |
8+
| read_multi_input.go | scanop_read_multi_input | fmt.Scan() で複数の値を読み取るサンプルです. |
9+
| read_formatted_input.go | scanop_read_formatted_input | fmt.Scanf() で書式化された入力値を読み取るサンプルです. |

examples/basic/scanop/read_formatted_input.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,20 @@ func ReadFormattedInput() error {
3232
output.Stdoutf("[fmt.Scanf]", "count=%d\tvalue1=%d\tvalue2=%s\n", n, value1, value2)
3333

3434
return nil
35+
36+
/*
37+
$ task
38+
task: [build] go build .
39+
task: [run] ./try-golang -onetime
40+
41+
ENTER EXAMPLE NAME: scanop_read_formatted_input
42+
43+
[Name] "scanop_read_formatted_input"
44+
INPUT(\d{1,3} [^ ]{1,5}): 111 abcde
45+
[fmt.Scanf] count=2 value1=111 value2=abcde
46+
47+
48+
[Elapsed] 16.812925838s
49+
*/
50+
3551
}

examples/basic/scanop/read_multiple_input.go

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,21 @@ func ReadMultipleInput() error {
3333
output.Stdoutf("[fmt.Scan]", "count=%d\tvalue1=%v\tvalue2=%v\n", n, value1, value2)
3434

3535
return nil
36+
37+
/*
38+
$ task
39+
task: [build] go build .
40+
task: [run] ./try-golang -onetime
41+
42+
ENTER EXAMPLE NAME: scanop_read_multi_input
43+
44+
[Name] "scanop_read_multi_input"
45+
INPUT: helloworld
46+
helloworld2
47+
[fmt.Scan] count=2 value1=helloworld value2=helloworld2
48+
49+
50+
[Elapsed] 6.552806734s
51+
*/
52+
3653
}

examples/basic/scanop/read_one_input.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,20 @@ func ReadOneInput() error {
2828
output.Stdoutf("[fmt.Scan]", "count=%d\tvalue=%v\n", n, value)
2929

3030
return nil
31+
32+
/*
33+
$ task
34+
task: Task "build" is up to date
35+
task: [run] ./try-golang -onetime
36+
37+
ENTER EXAMPLE NAME: scanop_read_one_input
38+
39+
[Name] "scanop_read_one_input"
40+
INPUT: helloworld
41+
[fmt.Scan] count=1 value=helloworld
42+
43+
44+
[Elapsed] 2.547842045s
45+
*/
46+
3147
}

0 commit comments

Comments
 (0)