Comments, Conditional commands and loops, Comments conditional commands and loops – Pinnacle Speakers DEKO500 User Manual

Page 126

Advertising
background image

Macro Programming Language

124

Deko500 User’s Guide

C

OMMENTS

A comment is text within a macro that does not affect the function of the macro.

Comments make macros easier to analyze and edit, especially if the macro was
written some time ago or written by another programmer. Many programmers
consider a program incomplete without comments. You may find the same to be true
of your macros.

A single-line comment starts with a pound sign (

#

). Deko500 ignores text to the right

of the pound sign.

# This comment is on a line by itself.

command # This one shares a line with a command.

Another way to create a comment is to precede the comment with

/*

and close it

with

*/

. Deko500 ignores text between

/*

and

*/

. This way, you can create

multiple-line comments.

/* This is a multiple-line comment.

None of this text affects the function

of this macro; Deko500 ignores

every line of it */

C

ONDITIONAL

C

OMMANDS AND

L

OOPS

Conditional commands instruct Deko500 to execute specific commands only under
certain circumstances. Deko500 supports the conditional commands

if

,

else

and

elseif

.

The

if

command includes a test expression, which evaluates to zero (false) or non-

zero (true). A list of one or more commands, then an

end

command, follows the

if

command:

if expression=

# commands

end

If the expression is true, Deko500 executes the commands between

if

and

end

.

The

if

command is often used with the

else

command:

if expression=

# commands

else

# commands

end

If the expression is true, Deko500 executes the commands between

if

and

else

;

otherwise, the commands between

else

and

end

are executed.

You can introduce more conditional actions by nesting conditions…

if $a==1

type

"

Hello

"

Advertising