Null object: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 2,168:
 
End Sub
</syntaxhighlight>
 
=={{header|Vlang}}==
Vlang does not have nor normally allow null or nil (also called "the billion dollar mistake"):
 
1) All primitive types/variables have default values.
 
2) For arrays and structs, default values are automatically assigned.
 
3) Usage of voidptr or nil, only done in unsafe, and is usually only for the purposes of interoperability with other languages.
<syntaxhighlight lang="vlang">
// Null or nil not used, default values for various primitive types/variables instead:
 
a_string :=''
a_bool := false
an_int := 0
[3]string{} // ['', '', '']
[3]bool{} // [false, false, false]
[3]int{} // [0, 0, 0]
</syntaxhighlight>
 
291

edits