numericPositive or negative integer and decimal numeric values.
AdvPL GuideLocal <variável> As <tipo> · Function <nome>(<parâmetro> As <tipo>) As <tipo>Declare variable, parameter, return, property and method types to make inconsistencies more visible.
AdvPL is dynamically typed, but explicit types may be declared in .PRW source files. These annotations help the compiler and AppServer identify incompatible assignments, parameters and return values. Documented types are numeric, character, date, codeblock, logical, array, object and variadic. TLPP typing has its own features and documentation.
Local <variável> As <tipo> · Function <nome>(<parâmetro> As <tipo>) As <tipo>numericPositive or negative integer and decimal numeric values.
character / charCharacter strings.
dateDate values.
codeblock / blockCode blocks that can be evaluated at runtime.
logicalTrue (.T.) or false (.F.) logical values.
arrayArrays that can contain values and structures.
objectClass instances or interface objects.
variadicA variable number of function parameters.
User Function ExTypes()
Local cMessage As Character
Local nQuantity As Numeric
Local dToday As Date
Local lActive As Logical
Local aItems As Array
cMessage := "Registration available"
nQuantity := 3
dToday := Date()
lActive := .T.
aItems := {"A", "B", "C"}
If lActive
MsgInfo(cMessage + " - items: " + CValToChar(nQuantity))
EndIf
ReturnEach variable declares its expected type, making incompatible assignments easier to identify.
User Function OrderTotal(nValue As Numeric, nQuantity As Numeric) As Numeric
Local nTotal As Numeric
nTotal := nValue * nQuantity
Return nTotalThe prototype documents that both parameters and the return value are numeric.
Class Pedido
Data nTotal As Numeric
Method New(nValor As Numeric) As Object
EndClass
Method New(nValor As Numeric) Class Pedido
::nTotal := nValor
Return SelfThe property, parameter and constructor return have declared types.
User Function ExIncompativel()
Local cCodigo As Character
Local nTotal As Numeric
nTotal := "ABC"
cCodigo := 10
ReturnThe compiler may issue warning W0015 for incompatible C and N conversions. Correct the source or convert the value deliberately.
© 2026 Usina.BR. Todos os direitos reservados. TOTVS, Protheus, Microsiga e seus respectivos logotipos são marcas de titularidade da TOTVS S.A. AdvPL é uma linguagem de programação desenvolvida pela TOTVS. O AdvPL Guia é um projeto independente, sem vínculo, representação, patrocínio ou afiliação com a TOTVS S.A., suas franquias ou representantes.