Usina BRAdvPL Guide
Sign in
← All topics
FOUNDATIONPublished

AdvPL syntax notation and conventions

COMANDO <obrigatório> [opcional]

Understand the symbols and patterns used to document AdvPL commands and functions.

SyntaxCommandsDocumentation
01 · OVERVIEW

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.

02 · SYNTAX

Syntax

COMANDO <obrigatório> [opcional]
03 · PRACTICAL EXAMPLE

Keywords and directives

#include "TOTVS.ch"

IF lExecutar
    ConOut("Execução autorizada")
ENDIF
Expected result

#include identifies a compiler directive. IF and ENDIF are command keywords and are shown in uppercase.

04 · PRACTICAL EXAMPLE

Required and optional parts

IF <condition>
    <statements>
[ELSE
    <alternative statements>]
ENDIF
Expected result

Elements inside < > must be supplied by the developer. The block inside [ ] is optional; the delimiters are not typed in the source.

05 · PRACTICAL EXAMPLE

Blocks, arrays and pass by reference

Local aValores := { 1, 2, 3 }
Local bDobro   := { |x| x * 2 }

AEval(aValores, bDobro)
Processa(@aValores)
Expected result

Braces delimit literal arrays and code blocks; vertical bars delimit block arguments; @ represents pass by reference.

06 · PRACTICAL EXAMPLE

Alternatives and repetition

IF ... ELSEIF ... ELSE ... ENDIF

// Alternative notation:
<optionA> / <optionB>
Expected result

Ellipses summarize an extensive or repetitive sequence. A slash separates alternative options in the documentation.

BEST PRACTICES
  • 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.
COMMON PITFALLS
  • 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.

Related content

REFERENCES
  1. TOTVS. AdvPL commands — syntax notation and conventions. TDN.
  2. TOTVS. #include — exemplo de diretiva do compilador AdvPL. TDN.
Status
Published
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR