another update, v0.22A, added two types of switch statements: normal and "true" switch statements.
Normal is of course what you'd expect:
Code:
/// Original:
switch x {
case 1, 2:
case 3:
default:
}
/// Generated:
switch (x) {
case 1, 2: {
}
case 3: {
}
default: {
}
}
Golang has a feature where you can omit the controller expression, which basically makes it "true" in terms of value. Thus you have "true" switch statements which can act as a more compact form of an if-else-if series. This is also supported and appropriately generated!
Code:
/// Original:
switch {
case x < 10, x+y < 10.0:
case x * y <= 1024.0:
default:
}
/// Generated:
if ((x < 10) || (x + y < 10.0)) {
}
else if ((x * y <= 1024.0)) {
}
else {
}
__________________