MvFUNCTIONRETURN#
An alias for MvFUNCTIONRETURN
, exits a function and optionally returns a value.
Syntax
<MvFUNCRETURN VALUE = "{ expression } | literal">
Attributes#
Attribute | Description |
---|---|
VALUE |
Optional value to return from a user-defined function. If no value is being returned it may be omitted. |
Examples#
In this example, if invalid parameters are passed to the function it returns without doing anything; otherwise it returns the sum of the two parameters.
<MvFUNCTION NAME="add" PARAMETERS="num1, num2" STANDARDOUTPUTLEVEL="html,text" >
<MvIF EXPR="{NOT l.num1 OR NOT l.num2}">
<MvFUNCTIONRETURN>
</MvIF>
<MvFUNCTIONRETURN VALUE="{ l.num1 + l.num2 }">
</MvFUNCTION>
````
Optionally, if a function does not return a value, the `<MvFUNCTIONRETURN>` tag may be omitted:
```xml
<MvFUNCTION NAME="salutation" PARAMETERS="name, title" STANDARDOUTPUTLEVEL="html,text" >
Sincerely Yours,<br><br>
<MvEVAL EXPR="{ l.name }"><br>
<br>
<MvEVAL EXPR="{ l.title }"><br>
</MvFUNCTION>