-
Notifications
You must be signed in to change notification settings - Fork 0
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
9398ea1
commit cb6b2ce
Showing
3 changed files
with
28 additions
and
8 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -34,7 +34,3 @@ func TestF(t *testing.T) { | |
println(f2()) | ||
println(f3()) | ||
} | ||
|
||
func main() { | ||
|
||
} |
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 keyword | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
//fallthrough 的使用规则: | ||
//fallthrough 只能用于 switch 语句中。 | ||
//它必须是某个 case 代码块的最后一条语句。 | ||
//使用 fallthrough 后,会无条件地执行下一个 case 代码块(即使下一个 case 的条件不匹配) | ||
|
||
func TestFallThrough(t *testing.T) { | ||
num := 2 | ||
switch num { | ||
case 1: | ||
fmt.Println("One") | ||
case 2: | ||
fmt.Println("Two") | ||
fallthrough | ||
case 3: | ||
fmt.Println("Three") | ||
case 4: | ||
fmt.Println("Four") | ||
default: | ||
fmt.Println("Other") | ||
} | ||
} |
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 |
---|---|---|
|
@@ -11,7 +11,3 @@ func TestMake(t *testing.T) { | |
//hash := make(map[int]bool, 10) | ||
//ch := make(chan int, 5) | ||
} | ||
|
||
func main() { | ||
|
||
} |