Navigation
Synopsis A return statement is missing from a function body.
Description Functions return some value (except functions that have return type void). This error is generated when a function body does not return a value.

Remedies:
  • Add a Rascal:Return statement to the function body.
  • Rewrite the function so that the function body becomes a single expression and you can use the abbreviated function format, see Rascal:Function.
Examples Here is an incorrect definition of function triple:
rascal>int triple(int x) {
>>>>>>>   x * 3;
>>>>>>>}
int (int): int triple(int);
rascal>triple(5)
|stdin:///|(0,31,<1,0>,<3,1>): Missing return statement
It should look like this:
rascal>int triple(int x) {
>>>>>>>   return x * 3;
>>>>>>>}
int (int): int triple(int);
rascal>triple(5)
int: 15
This is another solution using the abbreviated function format:
rascal>int triple(int x) = x * 3;
int (int): int triple(int);
rascal>triple(5)
int: 15
Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.