5 comments, 1 double asterisk, 2 double slash – ElmoMC SimplIQ Software Manual User Manual

Page 40: 3 c-style start and end comment, 5 comments -11, Double asterisk -11, Double slash -11, C-style start and end comment -11

Advertising
background image

SimplIQ

Software Manual

4BThe

SimplIQ

User Programming Language

MAN-SIMSW (Ver. 1.4)

5-11

5.5

Comments

Comments are texts that are written into the code to enhance its readability. They can be
written in three ways, as indicated in the following sections.

5.5.1

Double Asterisk

A comment starts with a double asterisk (**) marker and terminates at the next end of line.
The drive ignores the comments when running a program or evaluating an expression.

Example:
**my first program

PX=1

**UM=5

MO=1; **motor on

In this program, the first line is a comment used to enhance program readability. The
comment terminates at the next end of line, so that the PX=1 instruction will be compiled
and executed. In the third line, the comment marker tells the drive to ignore the UM=5
command. This technique is useful for temporarily masking program lines in the process of
debugging. The last line demonstrates that a comment may start anywhere in the program
line. The MO=1 instruction preceding the comment marker will be compiled and executed.

5.5.2

Double Slash

A double slash marks comments in the same way as a double asterisk. The comment starts
with a double slash marker and terminates at the next end of line.

Example:
//my first program

PX=1

//UM=5

MO=1; //motor on

In this example, the double slash acts exactly like the double asterisk from the previous
example.

5.5.3

C-style Start and End Comment

In the C-style method of marking comments, the comment begins with a start comment
mark (/*) and terminates with the end comment mark (*/). This enables the user to close
text in the middle of an expression, or to close several text lines.

Example:
/*

This is a multiple line comment.

All this text is ignored.

*/

if ( 1 / x == 1 */)

y=1;

end
The expression y = 1 will always be executed. The x==1 condition enclosed by the comment
markers is ignored.

Advertising