NIL values and variable initialization
Distinguishes missing values from zero and empty strings.
Overview
Nil has ValType U; zero is N, empty string C and .F. L. Initialization should match the intended contract rather than replacing absence with apparent success. Check content/ranges after type validation. The example uses declared xValue initialized with Nil, not an unknown variable name. This distinguishes undefined value from an unresolved-name error. (Sources: refs. 1–1.)
Commented example
#Include "Protheus.ch"
User Function Ed705()
Local xValue := Nil
// U differs from zero, empty text and false.
ConOut(ValType(xValue))
xValue := 0
ConOut(ValType(xValue))
Return NilDisplays U and N. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Do not index arrays or access methods before validating result existence/shape.
- Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Comments
There are no approved comments yet.
Sign in with Google or Microsoft to comment.