Null object: Difference between revisions

Content added Content deleted
 
Line 486: Line 486:
=={{header|Chapel}}==
=={{header|Chapel}}==


Class variables can be declared as nil if and only if they have nilable class type, declared with postfix ?, alongside memory management technique owned, borrowed, shared, or unmanaged. A nilable class type is default initialized to nil.
Objects variables without an initializer expression will be initiallized to nil:
<syntaxhighlight lang="chapel">class C { };
<syntaxhighlight lang="chapel">
class C { };
var c:C; // is nil
var c : owned C?; // is nil
writeln(if c == nil then "nil" else "something");</syntaxhighlight>
writeln(if c == nil then "nil" else "something");
</syntaxhighlight>


=={{header|Clojure}}==
=={{header|Clojure}}==