Null object: Difference between revisions

Content added Content deleted
(Pari/GP)
(→‎{{header|Tcl}}: Remove someone's ignorant and untested blunder; wrong is wrong!)
Line 529: Line 529:
if ![info exists arr(nullval)] ...
if ![info exists arr(nullval)] ...
if ![dict exists $dic nullval] ...</lang>
if ![dict exists $dic nullval] ...</lang>
You can also use this condition inside an if statement to check if the variable $value is set or not:
<lang Tcl>[expr {([string compare "$value[puts \"\"]" ""]==1)}]</lang>
I think this is the better way to achieve it. In this case, if $value is set, returns true, or else returns false.


{{omit from|TI-83 BASIC}} {{omit from|TI-89 BASIC}} <!-- Does not have a null value. -->
{{omit from|TI-83 BASIC}} {{omit from|TI-89 BASIC}} <!-- Does not have a null value. -->