Usina BRAdvPL Guide
Sign in
← All topics
FOUNDATIONUnder review

Comments, line continuation and source formatting

Organizes code to make intent and sequence readable.

Comments, line continuation and source formattingAdvPL
01 · OVERVIEW

Overview

AdvPL source separates declarations, commands, functions, directives and comments. Indentation helps readers but does not replace delimiters such as EndIf. Comments should explain conditions and decision intent. A long expression can continue on the next line using a semicolon at the preceding line end; keep continuation explicit and check compilation. The example adds values across two lines and explains its limit: a teaching calculation without monetary rounding rules. (TOTVS, n.d., refs. 1–2)

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"
User Function Ed305()
    Local nTotal := 0
    // Teaching sum: known values without persistence.
    nTotal := 10 + ;
              20
    ConOut(cValToChar(nTotal))
Return Nil
Expected result

Expected result: 30. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Avoid comments contradicting code and large dead-code blocks. Preserve authorship and dependency notices; review comments in each language.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Introdução / Estrutura da Linguagem. TDN. Accessed on 2026-10-26.
  2. TOTVS. Guia de Boas Práticas - ADVPL. TDN. Accessed on 2026-10-26.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha