"Multi-exit considered harmful" considered harmful

fun f1(...) do
  if (...) then
    r := ...
  else if (...) then
    r := ...
  else
    r := ...
  end if
  return ...
end fun
fun f2(...) do
  if (...) then
    return ...
  else if (...) then
    return ...
  else
    return ...
  end if
end fun
fun contract_example(...) do
  if (!check1) return ... end if
  if (!check2) return ... end if
  ...
  return ...
end fun
fun contract (...) when !check1 = ...
fun contract (...) when !check2 = ...
fun contract (...) = ...
comments powered by Disqus