Null object: Difference between revisions
m
→{{header|Phix}}
Line 1,047:
</pre>
There is also a builtin NULL, however it is equivalent to the integer 0 and will trigger a type check if assigned to a variable declared as string or sequence. In most programs the zero-length string/sequence (""/{}) suffices,
but if you want a variable that can be a string/sequence or NULL, but not other arbitrary integer/float values, use something like the following user-defined types:
<lang Phix>type nullableString(object o)
return string(o) or o=NULL
|