Language Reference - Comments

Although only one statement per line is allowed, a long statement can span multiple lines if an underscore " _" preceded by a blank is placed at the end of a "broken" line. String definition cannot be split in several lines, concatenation need to be used.

#include <MsgBoxConstants.au3>

MsgBox($MB_SYSTEMMODAL, "", "This is a rather long line, so I " & _
        "broke it with the underscore, _, character.")

 

The semicolon (;) is the comment character. Unless the semicolon is within a string, all text following it is ignored by the script interpreter/compiler.

; The next line contains a meaningful, end-of-line comment
Sleep(5000) ; Pause for 5 seconds

 

You can combine underscore and semicolon to put comments on lines and still have a long statement span on next line.

Local $aArray_1_ ; This _ is not a continuation character, nor is the next one
Local $aArray_2_
Local $aArray_3[8][2] = [ _
        ["Word", 4], _ ; Comment 1
        ["Test", 3], _
        ["pi", 3.14159], _ ; Associate the name with the value
        ["e", 2.718281828465], _ ; Same here
        ["test;1;2;3", 123], _
        [';', Asc(';')], _ ; This comment is removed, but the strings remain.
        ["", 0]]

 

It is also possible to comment of large blocks of script by using the #cs and #ce directives.