primitive type variables not nullable ?
Venkat Akkineni via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Feb 8 15:06:37 PST 2015
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 ?
More information about the Digitalmars-d-learn
mailing list