Next: , Up: Well-formedness – Functions   [Contents][Index]


11.10.1 Missing return

A typed function should return a value using the return statement. An error is issued when a return is not guaranteed. An example:

interface ihello
{
  in void hello ();
  behavior
  {
    on hello: {}
  }
}

component function_missing_return
{
  provides ihello p;
  behavior
  {
    bool a = true;
    bool b = false;
    bool c = true;
    bool func ()
    {
      if (a && b)
        return true;
      else if (c)
        illegal;
    }
  }
}

This results in the following error message:

function-missing-return.dzn:22:12: error: missing return