Function return value
Now, let's see how to return a value from a function to the calling code. The next example continues depicting the topic of function parameters. This time, we will create a function that accepts three parameters and returns the minimum of the three input values.
Create a new codeunit and declare a function in it. Call it Min. After inserting the function, return to the code editor, position the cursor on an empty line under the function name, and access the C/AL Locals window. In the Parameters tab, insert the parameter named A and choose Integer in the DataType field. When done, move to the next line and declare the Integer parameter B, then C. If you close C/AL Locals now, function Min with three Integer parameters ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access