Jump to content

Return multiple values: Difference between revisions

m
(→‎{{header|OCaml}}: Space safety of tuples)
Line 254:
Used: 1</pre>
 
The workaround is to explicitly access to each value with functions like [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALfst <code>fst</code>] and [http://caml.inria.fr/pub/docs/manual-ocaml/libref/Pervasives.html#VALsnd <code>snd</code>] that return only one element of the tuple:
 
<lang ocaml>val fst : 'a * 'b -> 'a
val snd : 'a * 'b -> 'b</lang>
 
<lang ocaml>let pair a b =
Cookies help us deliver our services. By using our services, you agree to our use of cookies.