SystemVerilog functions can have inputs and outputs. Using outputs is useful in case you want to return a queue from a function (or some other complex type), or in case you want to return two or more different variables from the function.
Example: Let’s say that you have a queue of numbers, and you want to return a queue of only even numbers, and you also need the value of the first element in the queue of even numbers.
Calling a function:
Read more on page 105 of this reference manual:http://ece.uah.edu/~gaede/cpe526/SystemVerilog_3.1a.pdf
Another option is to use passing the arguments by reference. Let’s say you need the second and last element in an array/queue.
Calling a function:
EDA Playground example: https://www.edaplayground.com/x/YM8M