Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Software Crestron 
SIMPL+
®
308 
z SIMPL+
®
Language Reference Guide - DOC. 5797G
Compiler Error 1304
declaration error:  Local variables must be declared at top of 
function
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;                  // ok
   STRING str[100];            // ok
   Print( “Inside MyFunc!” );
   INTEGER j;                  // error
   if ( i > 1 )
   {
      INTEGER k;               // error – if-statement block cannot
                                          contain local variables
   }
}
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()          // ok – MyFunc is global
{
   FUNCTION MyLocalFunc()  // error – MyLocalFunc is local to 
MyFunc
   {
   }
}