Multiple Return Values in Wolfram Language

Wolfram Language has built-in support for multiple return values through the use of lists. This feature is often used to return both results and additional information from a function.

```wolfram
(* The List{_,_} in this function signature shows that
   the function returns a list of 2 integers. *)
vals[] := {3, 7}

(* In the main function, we demonstrate how to use
   the multiple return values *)
main[] := Module[{a, b, c},
  (* Here we use pattern matching to assign the two 
     different return values from the call *)
  {a, b} = vals[];
  Print[a];
  Print[b];

  (* If you only want a subset of the returned values,
     use a blank pattern (_) *)
  {_, c} = vals[];
  Print[c]
]

(* Execute the main function *)
main[]

When you run this code, you’ll see the following output:

3
7
7

In Wolfram Language, functions that return multiple values typically return them as elements of a list. We can use pattern matching to easily extract these values into separate variables.

The blank pattern _ in Wolfram Language serves a similar purpose to the blank identifier _ in some other languages, allowing us to ignore certain return values if we don’t need them.

Wolfram Language also supports functions with variable numbers of arguments, which we’ll explore in a future example.