In JavaScript I see functions like:
function SomeFunc(i) {
var f = 0x80000000;
return Boolean(i & f);
}
What would be an analog in Golang? First of all, I see 0x80000000 is not possible, syntax is the second question
In JavaScript I see functions like:
function SomeFunc(i) {
var f = 0x80000000;
return Boolean(i & f);
}
What would be an analog in Golang? First of all, I see 0x80000000 is not possible, syntax is the second question
In JavaScript, coercing any non-boolean value to boolean just does a "falsiness" check; for the most part, any non-empty value is false and everything else is true. So the Go equivalent for an integer value would simply be:
return i != 0