No error occurs when I save this script. It executes without error too.
:SET &VAR1# = "ABC123" ! This is a comment.
:PRINT "Variable 1: &VAR1#"
The documentation indicates that this type of comment is not allowed. Here is the relevant passage from the “Comment Lines” section of the Script Structure documentation page (emphasis mine):
2017-08-24 15:33:09 - U00020408 Variable 1: ABC123
Are end-of-line comments allowed, or is the documentation in error? If this type of comment is allowed, in which set of circumstances it it permitted?
Each line starting with the exclamation mark character "!", is a comment. These lines are not considered as processing steps and skipped during script execution...If the exclamation mark character is used within a line, however, this line is not considered a comment.