PRIVATE
PRIVATE xVariavel := xValorDeclares a dynamically scoped variable.
Overview
Exists until its creating routine returns and is visible to called routines. A same-name Private in a nested call temporarily hides the earlier variable. Prefer Local and parameters unless dynamic visibility is required. The TDN page links to Classes de Variáveis, whose body was empty when consulted; scope was checked in historical training section 5.4. (Sources: refs. 1–2.)
Syntax
PRIVATE xVariavel := xValorCommented example
#Include "Protheus.ch"
User Function Ed598()
// Prefixed author-defined name reduces framework collisions.
Private _nEd598 := 10
ConOut(_nEd598)
Return NilPrints 10. The variable ends with this call. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.
- Scope is not access control. Avoid framework names and implicit state; check reentrancy in isolated tests.
- 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.