Because the zero value for a int8 is 0, the else branch is not necessary.
bitSet := true
var bitSetVar int8
if bitSet {
bitSetVar = 1
}
There are no conversions from bool to integer types. The if statement is the best you can do.
Because the zero value for a int8 is 0, the else branch is not necessary.
bitSet := true
var bitSetVar int8
if bitSet {
bitSetVar = 1
}
There are no conversions from bool to integer types. The if statement is the best you can do.