Undefined values: Difference between revisions

Content added Content deleted
Line 987: Line 987:
=={{header|Smalltalk}}==
=={{header|Smalltalk}}==
In Smalltalk, all variables are automatically initialized to nil. This includes instance variables (an object's private slots), class variables and locals. Also global and namespace bindings can only be created by passing an existing value (typically also: nil) to the creation message (at:put:). This is part of the language's specification, not implementation specific. Thus a variable cannot ever be undefined.
In Smalltalk, all variables are automatically initialized to nil. This includes instance variables (an object's private slots), class variables and locals. Also global and namespace bindings can only be created by passing an existing value (typically also: nil) to the creation message (at:put:). This is part of the language's specification, not implementation specific. Thus a variable cannot ever be undefined.

However, we can check for the existence of a global binding with:
<lang smalltalk>Smalltalk includesKey: #FooBar
myNamespace includesKey: #Baz</lang>


=={{header|Tcl}}==
=={{header|Tcl}}==