&& Command
Collapse the table of content
Expand the table of content

&& Command

Indicates the beginning of a nonexecuting inline comment in a program file.

&& [Comments]


&& [ Comments]

Specifies inline comments that follow.

Inserting inline comments to denote the end of the IF ... ENDIF, DO, and FOR ... ENDFOR structured programming commands greatly improves the readability of programs when including many such structures.

Caution noteCaution

Including double ampersands (&&) in a string literal, for example, "AAA&&BBB", generates an error. Instead, to include double ampersands, use concatenation as shown: "AAA&" + "&" + "BBB".


When using concatenation, use caution with placement of a single ampersand (&), which is used to perform macro substitution and thus might produce undesirable results. For example, suppose you assign the string "YYY" to a variable, BBB. Performing concatenation using "AAA&" and "&BBB" replaces "BBB" with "YYY", so instead of getting the result "AAA&&BBB", the result is "AAA&YYY". For more information, see & Command.

To continue a comment on the following line, place a semicolon (;) at the end of the comment line to be continued.


In earlier versions of Visual FoxPro, you cannot place && and a comment after the semicolon that is used to continue a command line to an additional line.

The following example includes the inline comments "20 years of monthly payments" indicated by the && command:

STORE (20*12) TO gnPayments  && 20 years of monthly payments
NOTE  Initialize the page number;
STORE 1 to gnPageNum
* Set up the loop
DO WHILE gnPageNum <= 25  && loop 25 times
   gnPageNum = gnPageNum + 1
ENDDO  && DO WHILE gnPageNum <= 25

Community Additions

© 2016 Microsoft