Compiler Error 1304; Compiler Error 1305 - Crestron SIMPL+ Reference Manual

Language reference guide
Hide thumbs Also See for SIMPL+:
Table of Contents

Advertisement

Software
®
308
SIMPL+

Compiler Error 1304

declaration error: Local variables must be declared at top of
All local variables within a function block must be declared before any statements are
encountered. Local variables are not allowed to be declared within a block of
statements such as inside an if-else or while loop.
The following are examples of this error:
FUNCTION MyFunc( INTEGER arg1, STRING arg2 ) // ok
{
INTEGER i;
STRING str[100];
Print( "Inside MyFunc!" );
INTEGER j;
if ( i > 1 )
{
INTEGER k;
}
}

Compiler Error 1305

declaration error: Local functions not supported
A function cannot be defined within another function definition. All function
definitions must be defined with a global scope inside the module.
Scope refers to the level at which an Event, user-defined function or statement
resides. Having a global scope means that the function or variable can be called or
accessed from anywhere within the program. A local scope means that the variable
can only be accessed from within the event or function that it resides in.
The following are examples of this error:
FUNCTION MyFunc()
{
FUNCTION MyLocalFunc()
MyFunc
{
}
}
function
// ok
// ok
// error
// error – if-statement block cannot
// ok – MyFunc is global
// error – MyLocalFunc is local to
Language Reference Guide - DOC. 5797G
Crestron SIMPL+
contain local variables
®

Advertisement

Table of Contents
loading

Table of Contents