![]() |
|
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:
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 statementIt should look like this: rascal>int triple(int x) { >>>>>>> return x * 3; >>>>>>>} int (int): int triple(int); rascal>triple(5) int: 15This 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 ![]() |