To make an example the following expression can be considered to have two returns:
max x y =
if x > y
then x
else y
The Java equivalent is int max(int x,int y) {
if (x>y)
return x;
else
return y;
}
Some people abhor the idea of having multiple returns in a method, and say that you should write it like int max(int x, int y) {
int result;
if (x>y)
result = x;
else
result = y;
return result;
}
(Disclaimer: Contrived and buggy example as I am on mobile)