AdvPL syntax notation and conventions
COMANDO <obrigatório> [opcional]Understand the symbols and patterns used to document AdvPL commands and functions.
Overview
AdvPL documentation uses standardized notation to distinguish keywords, required values, optional clauses, code blocks, pass-by-reference arguments and syntax alternatives. These symbols explain how to write the code, but they are not always part of the command being entered.
Syntax
COMANDO <obrigatório> [opcional]Keywords and directives
#include "TOTVS.ch"
IF lExecutar
ConOut("Execução autorizada")
ENDIF#include identifies a compiler directive. IF and ENDIF are command keywords and are shown in uppercase.
Required and optional parts
IF <condition>
<statements>
[ELSE
<alternative statements>]
ENDIFElements inside < > must be supplied by the developer. The block inside [ ] is optional; the delimiters are not typed in the source.
Blocks, arrays and pass by reference
Local aValores := { 1, 2, 3 }
Local bDobro := { |x| x * 2 }
AEval(aValores, bDobro)
Processa(@aValores)Braces delimit literal arrays and code blocks; vertical bars delimit block arguments; @ represents pass by reference.
Alternatives and repetition
IF ... ELSEIF ... ELSE ... ENDIF
// Alternative notation:
<optionA> / <optionB>Ellipses summarize an extensive or repetitive sequence. A slash separates alternative options in the documentation.
- Native command and function keywords are shown in uppercase.
- Compiler directives are preceded by #, such as #include.
- Commas separate clauses or arguments; a slash indicates alternatives.
- Ellipses represent repetitive or extensive sections.
- File names are shown in uppercase and extensions begin with a dot, such as MATA020.PRW.
- The < and > signs represent required information and must not be copied as part of the instruction.
- Brackets indicate optional parts, except when they belong to actual array syntax.
- The @ symbol indicates that an argument is passed by reference.
- In the source convention, an asterisk after a name identifies an obsolete command or function.
