return (x, y, z)returns values x, y and z from the function. Another approach might be to use an array.
Tuples can also be useful in switch statements. For example.
switch (one, two)
{
case (0,0):
return 1
case (1,_):
return 2
case (_,2):
return 3
default:
return 4
}
If one and two equal zero return 1. If one is 1 and two is any number return 2. If one is any number and two is 2 return 3. Otherwise return 4 as the default.