Undefined values: Difference between revisions

m (→‎{{header|Phix}}: added syntax colouring the hard way, phix/basics)
Line 859:
<lang MUMPS> IF $DATA(SOMEVAR)=0 DO UNDEF ; A result of 0 means the value is undefined
SET LOCAL=$GET(^PATIENT(RECORDNUM,0)) ;If there isn't a defined item at that location, a null string is returned</lang>
 
=={{header|Nim}}==
In Nim, all variables are initialized to a default value which is a binary zero. If this value is incompatible with the variable type, a warning is emitted.
 
So, there are no undefined values except if the user explicitly specified that the variable must not be initialized. This may be useful for instance for a big array which will be initialized later on. To avoid the implicit initialization, we use the pragma <code>{.noInit.}</code>. For instance:
<lang Nim>var a {.noInit.}: array[1_000_000, int]
 
# For a proc, {.noInit.} means that the result is not initialized.
proc p(): array[1000, int] {.noInit.} =
for i in 0..999: result[i] = i</lang>
 
=={{header|OCaml}}==
Anonymous user