Topic: Need Information
Can anyone tell why do you place dot after end instead of semi colon; just like below
begin
end.
My Visual Database → General → Need Information
Can anyone tell why do you place dot after end instead of semi colon; just like below
begin
end.
The main block of any module, i.e. program, unit or library, has to be closed with an end “dot”:
It can be seen as an adoption of natural (written) languages, where a full stop marks an end of a sentence.
Anything else after the final end., assuming syntactical correctness, will be ignored by the compiler.
https://wiki.freepascal.org/period
Thank you brain. It means full stop stops procedure. Will it affect other procedures?
unforgettable,
The full stop is the end of the complete program. All procedures and functions must be before the begin.....end..
A procedure or function must finish with a end;.
So for example:
procedure loadSettings;
var
settingsIni : TStringlist;
lngth : integer;
begin
settingsIni := TStringList.Create;
settingsIni.LoadFromFile ('Settings.ini');
dbName := SettingsIni[4];
SettingsIni.free;
lngth := Length(dbName) - 7;
dbName := copy(dbName, 8, lngth);
FrmMain.lbDbPath.Caption := ExtractFilePath(Application.ExeName)+ dbName;
end; //procedure ends with a semicolon
function CountBackups(dir: string) : string;
var
fileList : TStringList;
// count : integer;
begin
result := '0';
fileList := TStringList.Create;
fileList.Text := GetFilesList(dir, '*.db',False);
result := intToStr(fileList.Count -1);
fileList.Free;
end; // Function ends with a semicolon
begin
end. //complete program finishes here.
In MVD the begin-------end. is used for any code that must run when your program first starts and before your form appears. In most cases you will leave this part of the script blank.
My Visual Database → General → Need Information
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi