# Question:on returning multiple results from a proc

## Question:on returning multiple results from a proc

Maple 2020

Maple can return multiple values as expression sequence. The problem with this is that if one of the values is NULL, then one gets an error on the receiving end.

For example, suppose a proc foo() is meant to return 3 separate values. When doing

a,b,c := foo()

This will fail if one of the values was NULL. For example, if b  was NULL, then Maple returns a,c only. The NULL value is discarded.

```foo:=proc()
local a,b,c;
a:=1; b:=NULL; c:=3;
return a,b,c;
end proc;

a,b,c := foo()

```

Error, mismatched multiple assignment of 3 variables on the left side and 2 values on the right side

I'd like to use NULL to indicate that this variable has no value (may be it could be something that could not be computed inside foo, or some solution that could not be found, and for any other reason.)

So currently I use {} instead of NULL everywhere to indicate no value for that variable and that works

```foo:=proc()
local a,b,c;
a:=1; b:={}; c:=3;
return a,b,c;
end proc;

a,b,c := foo()
```

And now I check using if b={} instead of if b=NULL and that works OK for what I want.

It would be nice if one could do this

[a,b,c] := foo()

And even if b was NULL, it will still keep that slot. But Maple will also replace [a,b,c]  with [a,c]  if b was NULL

So what is NULL used for in Maple exactly? (help says it is used to initialize an expression sequence). Since one can't return NULL as value.

In Mathematica, NULL can be returned as an actual value. For example

```foo[] := Module[{a, b, c},
a = 1; b = Null; c = 3;
{a, b, c}
];

{a, b, c} = foo[]

```

gives

{1, Null, 3}

My question: is using {} in place of NULL a common practice  in Maple to indicate no value for a variable being returned? Or is there a better way than this?

﻿