mardi 20 novembre 2018

Why does 0 integer value behaves as false in if statement in groovy?

I wrote this part of code.

Integer value = 0
if(value)
{
    print "true"
}
else
{
    print "false"
}

And the output of code is false. Can someone explain me why does Integer 0 value behaves as false in this if statement when it is not null and it exists?

Aucun commentaire:

Enregistrer un commentaire