Since it's pseudo-code, just about anything goes.
However, I'd rather go for omitting "list"
:
return (0, 0)
return (vr + p->cost, 1)
return (vl + p->cost, 0)
There doesn't seem to be any real benefit to putting "list"
there - the (..., ...)
format pretty clearly indicates returning two values already - there's no need to explicitly say you're returning them in a list
.
Side note: You mention list
, array
or vector
, but pair
is another option in some languages, or wrapping the two in an object (typically giving the advantage of compile-time type checking - not really applicable in pseudo-code, obviously).
You could consider replacing "list"
with "pair"
instead of removing it if you wish to make it clear that the function only ever returns exactly 2 values.