Global Mapper Pro

Is it Possible to Comment Out Blocks of Text with /*?

kbellis
kbellis Global Mapper UserTrusted User
The double forward slash // works great for commenting out a single line, and one line only, but is there anyway to comment out entire blocks of coded lines; e.g.,

/*
blah
blah
blah
*/

Best Answer

  • JeffH@BMG
    JeffH@BMG Global Mapper Developer
    Accepted Answer
    Hi Kelly,

    Per the Script Command reference:

    Comments

    Any lines that begin with the forward slash character (/) are considered comments and are ignored by the script processing engine. This means that you can use C or C++ style comments like // or /* at the start of your line. 



    But note that this applies to a single line only, and '*/' has no meaning whatsoever (it also means that '//' is not necessary to start a comment; a single '/' will do). So no,  /* */ doesn't work across multiple lines in Global Mapper scripts.

    Best regards,

    ~Jeff

Answers

  • kbellis
    kbellis Global Mapper User Trusted User
    Thanks for your reply Jeff!

    Okay, so the help file should read that you CANNOT use C or C++ style comments for multiline comments; e.g.,
    Multi-line comments (informally, C style), start with /* and end with */.,

    Only Single-line comments (informally, C++ style), start with // and continue until the end of the line. If the last character in a comment line is a \ the comment will continue in the next line.

    So therein is another deviation from C style, Global Mapper only needs a single /



Sign In or Register to comment.