colors = [
                "black" : "నలుపు",
                "white"       : "తెలుపు",
                "red" : "యెరుపు",
                "green"       : "పచ్చ",
                "blue"        : "నీలం"
        ];
        
        writefln("Before: ");
        writeln(colors);
        colors = null;
        writefln("after: ");
        writeln(colors);

This above bit of code is trying to delete all elements at once by assigning a null to colors associative array. Interesting thing is the write output after assigning null to colors variable shows "[]".


Here is the output.

Before:
["blue":"నీలం", "red":"యెరుపు", "white":"తెలుపు", "green":"పచ్చ", "black":"నలుపు"]
after:
[]


So primitive types can never be null ? An null assignment would set the primitive type variable to a default value ?

Reply via email to