Survey programming comments are text that is ignored by the IntelliSurvey code parser. Comments can serve multiple purposes. They can function as notes to add information or context about the code, or they can be used as a tool to "comment out", or disable, sections of code without having to erase it. In the Edit applet, comments are automatically recognized and grayed out, with the system ignoring commented out content when it parses survey code.
Syntax
Single line comment
For a single line comment, use a '#' symbol. This is useful for short notes or to disable individual lines of code. This syntax is adopted from the Perl programming language.
In the below example, the 'Yellow' option will not be displayed, nor will it be included in the survey data, because that option has been commented out. Additionally, single line comments are not considered blank lines by the code parser, so they can be inserted in the middle of widgets without causing errors, as seen with the "Waiting for client..." note.
1. What is your favorite color?
type: radio
# Waiting for client confirmation on the final option list.
1. Red
2. Blue
#3. Yellow
Multi-line comment
This syntax is most useful when there are many lines in the comment, or you would like to comment out a large section of code. The opening /*
must be preceded by a blank line. The closing */
does not need a blank line after it, but it is recommended for better readability. Everything between the opening and closing elements will be considered a comment. This syntax is adopted from JavaScript.
In this example, Q1 will not be asked or included in the survey data, nor will the note above it be displayed on-screen.
/* This question is not finished yet.
1. Do you own any pets?
type: radio
1. Yes */
Element decorator comment
The comment syntax below is applied as an element decorator, enabling comments on the same line as a list item or a list reference such as optsfrom
.
setlist: COLORS
1. red
2. blue
3. yellow
4. purple { # may remove this option later }
1. Select your favorite color.
type: radio
optsfrom: COLORS { # should we include other colors? }
Comments
0 comments
Please sign in to leave a comment.