Am 15.01.21 um 12:43 schrieb Riccardo (Jack) Lucchetti:
On Fri, 15 Jan 2021, Artur Bala wrote:
> Dear developers,
> I thought that the following "if" conditions are supposed to give the
> same
> results but they actually don't. And the 2nd "if" block ignores
"NA"
> values
Interesting.
The problem you report can be exemplified even more easily as
<hansl>
scalar z = NA
if z < 0
print "A"
else
print "B"
endif
</hansl>
I'm not sure what we should do in an "if" block if the condition is
neither true or false. At the moment, we treat NA as true (because it's
non-zero), but I wonder if we should throw an error instead.
For instance, the golang compiler say in this situation "non-boolean
condition in if statement" for:
<go>
foo := math.NaN
if foo {
println("something")
}
</go>
I think we should also throw an error.
Artur