最近寫Golang的是發現一個fallthrough與switch的坑:
switch value.(type) { case int: fallthrough case int64: //...... }
編譯就報錯:
cannot fallthrough in type switch
WHAT????
在type switch 中不能使用
fallthrough
只能修改代碼:
switch value.(type) { case int , int64: //...... }
最近寫Golang的是發現一個fallthrough與switch的坑:
switch value.(type) { case int: fallthrough case int64: //...... }
編譯就報錯:
cannot fallthrough in type switch
WHAT????
在type switch 中不能使用
fallthrough
只能修改代碼:
switch value.(type) { case int , int64: //...... }