The keyword "result" is accepted by the compiler only for some compilation modes. And the by-default mode for the compiler (i.e. if you do not indicate one by yourself) doesn't accept it.
There are 3 solutions for your problem, to indicate a compatible compilation mode for your programs. The second one is the simplest (for a simple program), unless you are using the Lazarus IDE (in this case, choose the 3rd one):
1/ If you compile your programs by calling the compiler yourself, you'll have to add a "compatible" mode for the compilation (ObjFPC or Delphi).
For instance:
fpc -MObjFPC project1.pas
(instead of just fpc project1.pas)
2/ Or, you can select the "compatible" mode directly into the source of your program.
For instance, hereafter a very basic free pascal program accepting the keyword "result" (please note the additional line "{$mode objfpc}", at the beginning of the source code for the concerned unit):
program project1;
{$mode objfpc}
function Test(): string;
begin
result:='A string...';
end;
begin
WriteLn(Test());
end.
3/ Or, if you are using the Lazarus IDE, the by-default mode for your whole project (i.e. all its units) may be changed into the project options (i.e. the compilation mode indication "job" is done by the IDE).
Main Lazarus IDE menu: Project -> Project options... -> Compiler Options -> Parsing -> Syntax mode.
If it's not already the case, choose the "Object Pascal" or the "Delphi" mode.