func TestSwitchCaseCondition(t *testing.T) { for i := 0; i < 5; i++ { switch i { case i % 2 == 0: t.Log("Even") case i % 2 == 1: t.Log("Odd") default: t.Log("Unknown") } } } 报错: invalid case i % 2 == 0 in switch on i (mismatched types bool and int) invalid case i % 2 == 1 in switch on i (mismatched types bool and int)