LOCAL
LOCAL xVariable [:= xInitial], ...Declares function-local variables.
Overview
An uninitialized declaration leaves NIL, which should not be used directly in arithmetic. Initialize values and pass data explicitly to avoid Private/Public dependencies. This subset does not redefine block capture or the distinction between declared type and assigned value. (Sources: refs. 1–2.)
Syntax
LOCAL xVariable [:= xInitial], ...Return value
Declaration command; no function return.
Commented example
#Include "Protheus.ch"
User Function Ed508()
Local nQty := 3
Local nUnit := 10
Local nTotal := nQty * nUnit
// Initialize before calculating.
ConOut(cValToChar(nTotal))
Return NilResult: 30. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Declare variables at routine start and avoid framework-reserved names.
- 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.