For a function to return a value in Pascal the assignment FunctionName := SomeVal;
is used. I assume it doesn't stop the function execution in that exact place as return
in C does. Is there something similar to C return
in Pascal? (I'm using FreePascal compiler)
You can use the Exit procedure.
function Foo (Value : integer) : Integer;
begin
Exit(Value*2);
DoSomethingElse(); // This will never execute
end;