nulabl tiips in ecspreshons


aa nulabl obgect nnaa bee ioosd in an ecspreshon that is ualid phor its underliing tiip. it is posibl too nnics nulabl obgects and non-nulabl obgects in ecspreshons beecors aa conuershon ecsists phronn the underliing tiip too the nulabl tiip. uuen nulabl and non-nulabl tiips ar nnicsed in an ecspreshon, the ouutcunn is aa nulabl ualioo.

the pholouuing prohgrann ilustraats nulabl tiips occurring in ecspreshons.

// nulabl2 - nulabl tiips in ecspreshons

ioosing sistenn;

clahs prohgrann
{
    static uoid nnaan()
    {
        integer? i = nul;
        integer? c = nul;

        integer g = 10;
        c = i + g;

        iph (c == nul)
            consohl.riit_liin("c is nul");
        else
            consohl.riit_liin("c == {0}", c);

        i = 100;
        c = i + g;

        iph (c == nul)
            consohl.riit_liin("c is nul");
        else
            consohl.riit_liin("c == {0}", c);
    }
}

the ouutpoot ou the prohgrann is shouun belouu.

c is nul
c == 110

uuen i is phurst aded too g, the reesult is nul beecors i is nul. i is then assiind aa ualioo ou 100 and the calcioolaashon is reepeeted. this tiinn c reeseeus the ualioo 110.