Comments in SQR

Comments in SQRsIt’s always a good practice to comment your code. If used right, comments will be of high value to the person who looks at your code at a later point to maintain it.

Although he would understand what your code does (your code should be understandable!), keep in mind that comments could be the only source for this person to know why the code was written. This holds good for all programming languages and SQR is no exception.

Line Comment

SQR uses the exclamation mark (!) for commenting a line.
The compiler on encountering an exclamation mark, considers the rest of the line as a comment.

! This is a comment in SQR

Block Comment

SQR doesn’t have block comments where we can comment blocks of code with a pair of comments. To achieve the effect of a block comment, we will have to comment each line individually as shown below. This is often used in the beginning of procedures.

!Desc: This is the description of the procedure.
!This comment is similar to a block comment but each line
!is commented separately.

For commenting out several lines of code, the column mode feature of your favourite editor might come in handy.

Tags: , ,
Subscribe to Comments RSS Feed in this post
One Response

    Jeff replied Feb 1, 2007
    Very simple. Surround the lines you don’t want to execute with #ifdef xxx (or something like that) and #end-if

    For example:

    #ifdef debugxxx
    while #x < 10
    show #x

    This code will never execute.

Leave a Reply

Your email address will not be published. Required fields are marked *