Crestron simpl plus language ref 사용자 설명서

다운로드
페이지 374
Software Crestron 
SIMPL+
®
272 
z SIMPL+
®
Language Reference Guide - DOC. 5797G
Returning a Value
The syntax for returning a value from integer and string functions is RETURN 
<expression>;.   To return a value from a FUNCTION, PUSH, CHANGE, RELEASE 
or EVENT, the syntax is RETURN.
Integer functions include INTEGER_FUNCTION, 
SIGNED_INTEGER_FUNCTION, LONG_INTEGER_FUNCTION and 
SIGNED_LONG_INTEGER_FUNCTION. String functions include 
STRING_FUNCTION.
For Integer Functions, any valid integer expression is legal. For example:
RETURN (25);
RETURN (Z + MULDIV(A,B,C) + 100);
Are legal (assuming Z, A, B, C, are INTEGERs). If no RETURN statement is present 
in an integer, 0 is returned.
For a string function, any valid string is legal (string expressions are not allowed). For 
example:
STRING str[100];    
RETURN “Hello!\n”;
RETURN (str);
Are legal (assuming Z is an INTEGER and A$ is a STRING). If no RETURN 
statement is present in a STRING_FUNCTION, an empty string (““) is returned.
In SIMPL Version 3.00, the RETURN statement without arguments can be used in 
all functions that do not return strings or integers. For example:
INTEGER_FUNCTION MyIntegerFn ( )
{
IF (1) 
{
RETURN (1); 
}
RETURN (0); 
}
LONG_INTEGER_FUNCTION MyLongIntFn ( )
{
IF (1) 
{
SIGNED_INTEGER_FUNCTION MySignedIntFn ( )
{
IF (1) 
{
RETURN (1); 
}
RETURN (0); 
}
SIGNED_LONG_ INTEGER_FUNCTION MySignedLongIntFn ( )
NOTE: A zero (0) message is automatically returned if no return statement is 
encountered.