PUBLIC
PUBLIC xVariavel := xValorDeclares state that can persist in the thread.
Overview
Survives a function return until thread/connection termination or explicit release. A same-name Private can hide it. This does not create shared global storage across users or servers. Historical training section 5.5 contains a Public example accidentally written with Private; this page uses the correct declaration. (Sources: refs. 1–2.)
Syntax
PUBLIC xVariavel := xValorCommented example
#Include "Protheus.ch"
User Function Ed607()
// Isolated session only; do not store secrets in Public state.
Public _nEd607 := 10
ConOut(_nEd607)
Release _nEd607
Return NilPrints 10 and releases the exercise-specific name. 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.