-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eaa447f
commit 1716c9b
Showing
29 changed files
with
360 additions
and
404 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;const(A=1;B int=2;C,D int=3,4;E,F,G=3,4,5);const(_=iota;a;b;c);const w=1;const x int=2;const y,z=3,4;func main(){const a=1;const b,c=2,3;const(d=4;e=5);}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main | ||
|
||
const ( | ||
A = 1 | ||
B int = 2 | ||
C, D int = 3, 4 | ||
E, F, G = 3, 4, 5 | ||
) | ||
|
||
const ( | ||
_ = iota | ||
a | ||
b | ||
c | ||
) | ||
|
||
const w = 1 | ||
const x int = 2 | ||
const y, z = 3, 4 | ||
|
||
func main() { | ||
const a = 1 | ||
const b, c = 2, 3 | ||
const ( | ||
d = 4 | ||
e = 5 | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;func main(){for {break};for i:=0;i<10;i++{println(i)};for i:=0;i<10;{println(i);i++};for i:=0;;i++{if i>=10{break};println(i)};i:=0;for ;i<10;i++{println(i)};for i<20{println(i);i++};for true{break}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package main | ||
|
||
func main() { | ||
for { | ||
break | ||
} | ||
|
||
for i := 0; i < 10; i++ { | ||
println(i) | ||
} | ||
|
||
for i := 0; i < 10; { | ||
println(i) | ||
i++ | ||
} | ||
|
||
for i := 0; ; i++ { | ||
if i >= 10 { | ||
break | ||
} | ||
println(i) | ||
} | ||
|
||
i := 0 | ||
for ; i < 10; i++ { | ||
println(i) | ||
} | ||
|
||
for i < 20 { | ||
println(i) | ||
i++ | ||
} | ||
|
||
for true { | ||
break | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import "fmt";func hello(){func(){fmt.Println("Hello")}();func(s string){fmt.Printf("Hello, %s\n",s)}("world");if err:=func()error{return nil}();err!=nil{fmt.Println(err)}};func main(){go hello()}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func hello() { | ||
func() { | ||
fmt.Println("Hello") | ||
}() | ||
|
||
func(s string) { | ||
fmt.Printf("Hello, %s\n", s) | ||
}("world") | ||
|
||
if err := func() error { | ||
return nil | ||
}(); err != nil { | ||
fmt.Println(err) | ||
} | ||
} | ||
|
||
func main() { | ||
go hello() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import "fmt";func Ptr[T any](p T)*T{return &p};func Equals[T,U comparable](t T,u U)bool{return t==u};func Hoge[T comparable,U fmt.Stringer](s []T,e U)bool{return true};func main(){fmt.Println(Ptr(1))}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func Ptr[T any](p T) *T { | ||
return &p | ||
} | ||
|
||
func Equals[T, U comparable](t T, u U) bool { | ||
return t == u | ||
} | ||
|
||
func Hoge[T comparable, U fmt.Stringer](s []T, e U) bool { | ||
return true | ||
} | ||
|
||
func main() { | ||
fmt.Println(Ptr(1)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import("fmt";"time");func hello(){fmt.Println("Hello, 世界");time.Sleep(1*time.Second)};func main(){go func(){fmt.Println("Hello, 世界");time.Sleep(1*time.Second)}();go hello()}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"time" | ||
) | ||
|
||
func hello() { | ||
fmt.Println("Hello, 世界") | ||
time.Sleep(1 * time.Second) | ||
} | ||
|
||
func main() { | ||
go func() { | ||
fmt.Println("Hello, 世界") | ||
time.Sleep(1 * time.Second) | ||
}() | ||
|
||
go hello() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import "fmt";func main(){fmt.Println("A");goto label;fmt.Println("B");label:fmt.Println("C")}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
fmt.Println("A") | ||
goto label | ||
fmt.Println("B") | ||
label: | ||
fmt.Println("C") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import "fmt";func main(){if true{fmt.Println("TRUE");if true{fmt.Println("TRUE")}};if false{fmt.Println("TRUE")}else{fmt.Println("FALSE")};if false{fmt.Println("TRUE")}else if true{fmt.Println("TRUE")};if err:=run1();err!=nil{fmt.Println(err)};if _,err:=run2();err!=nil{fmt.Println(err)}};func run1()error{return nil};func run2()(string,error){return "",nil}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
if true { | ||
fmt.Println("TRUE") | ||
if true { | ||
fmt.Println("TRUE") | ||
} | ||
} | ||
|
||
if false { | ||
fmt.Println("TRUE") | ||
} else { | ||
fmt.Println("FALSE") | ||
} | ||
|
||
if false { | ||
fmt.Println("TRUE") | ||
} else if true { | ||
fmt.Println("TRUE") | ||
} | ||
|
||
if err := run1(); err != nil { | ||
fmt.Println(err) | ||
} | ||
|
||
if _, err := run2(); err != nil { | ||
fmt.Println(err) | ||
} | ||
} | ||
|
||
func run1() error { | ||
return nil | ||
} | ||
|
||
func run2() (string, error) { | ||
return "", nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import "fmt";func main(){i:=1;i++;i--;i++;fmt.Println(i)}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
i := 1 | ||
i++ | ||
i-- | ||
i++ | ||
fmt.Println(i) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;type I1 interface{F1()string;F2()(string,error);F3()(s string,err error)};type I2 interface{I1;F4(s string);F5(string);F6(s1,s2 string);F7(s1 string,s2 string);F8(s1,s2 string,i int);F9(f func()string)}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package main | ||
|
||
type I1 interface { | ||
F1() string | ||
F2() (string, error) | ||
F3() (s string, err error) | ||
} | ||
|
||
type I2 interface { | ||
I1 | ||
|
||
F4(s string) | ||
F5(string) | ||
F6(s1, s2 string) | ||
F7(s1 string, s2 string) | ||
F8(s1, s2 string, i int) | ||
F9(f func() string) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;func main(){for range 10{break};for i:=range 10{println(i)};for _,s:=range []string{"a","b","c"}{println(s)};for i,s:=range []string{"a","b","c"}{println(i,s)};for i:=range []string{"a","b","c"}{println(i)}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package main | ||
|
||
func main() { | ||
for range 10 { | ||
break | ||
} | ||
|
||
for i := range 10 { | ||
println(i) | ||
} | ||
|
||
for _, s := range []string{"a", "b", "c"} { | ||
println(s) | ||
} | ||
|
||
for i, s := range []string{"a", "b", "c"} { | ||
println(i, s) | ||
} | ||
|
||
for i := range []string{"a", "b", "c"} { | ||
println(i) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import "fmt";func main(){s:=[]string{"A","B","C"};fmt.Println(s[0]);fmt.Println(s[0:1]);fmt.Println(s[0:]);fmt.Println(s[:1]);fmt.Println(s[:])}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
s := []string{"A", "B", "C"} | ||
|
||
fmt.Println(s[0]) | ||
fmt.Println(s[0:1]) | ||
fmt.Println(s[0:]) | ||
fmt.Println(s[:1]) | ||
fmt.Println(s[:]) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;type S1 struct{S struct{A string;B int;C bool};F1 func()string;F2 func()(string,error);F3 func()(s string,err error)};type S2 struct{S1;A string;B int;C bool;a string;b int;c bool;F4 func(s string);F5 func(string);F6 func(s1,s2 string);F7 func(f1 func()string)};func main(){type S3 struct{S1;A string;B int;C bool};}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package main | ||
|
||
type S1 struct { | ||
S struct { | ||
A string | ||
B int | ||
C bool | ||
} | ||
|
||
F1 func() string | ||
F2 func() (string, error) | ||
F3 func() (s string, err error) | ||
} | ||
|
||
type S2 struct { | ||
S1 | ||
|
||
A string | ||
B int | ||
C bool | ||
|
||
a string | ||
b int | ||
c bool | ||
|
||
F4 func(s string) | ||
F5 func(string) | ||
F6 func(s1, s2 string) | ||
F7 func(f1 func() string) | ||
} | ||
|
||
func main() { | ||
type S3 struct { | ||
S1 | ||
|
||
A string | ||
B int | ||
C bool | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;import "fmt";func main(){i:=0;switch i{case 0:fmt.Println("1");fmt.Println("2");fmt.Println("3");case 1,2:fmt.Println("4");fmt.Println("5");fmt.Println("6");default:fmt.Println("7");fmt.Println("8");fmt.Println("9")}}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package main | ||
|
||
import "fmt" | ||
|
||
func main() { | ||
i := 0 | ||
|
||
switch i { | ||
case 0: | ||
fmt.Println("1") | ||
fmt.Println("2") | ||
fmt.Println("3") | ||
case 1, 2: | ||
fmt.Println("4") | ||
fmt.Println("5") | ||
fmt.Println("6") | ||
default: | ||
fmt.Println("7") | ||
fmt.Println("8") | ||
fmt.Println("9") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package main;var(A=1;B int=2;C,D int=3,4;E,F,G=3,4,5);var w=1;var x int=2;var y,z=3,4;func main(){var a int=1;var b,c int=2,3;var(d=4;e=5);}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
var ( | ||
A = 1 | ||
B int = 2 | ||
C, D int = 3, 4 | ||
E, F, G = 3, 4, 5 | ||
) | ||
|
||
var w = 1 | ||
var x int = 2 | ||
var y, z = 3, 4 | ||
|
||
func main() { | ||
var a int = 1 | ||
var b, c int = 2, 3 | ||
var ( | ||
d = 4 | ||
e = 5 | ||
) | ||
} |