1
0

First commit

This commit is contained in:
Timothy Warren 2021-09-23 12:15:42 -04:00
commit b394bbe7dd
31 changed files with 875 additions and 0 deletions

46
.gitignore vendored Normal file
View File

@ -0,0 +1,46 @@
# Created by https://www.toptal.com/developers/gitignore/api/freepascal,lazarus
# Edit at https://www.toptal.com/developers/gitignore?templates=freepascal,lazarus
### FreePascal ###
*.lps
*.compiled
*.[oa]
*.ppu
*.rst
*.cgi
*.exe
*.log
*.bak*
fp.ini
fp.cfg
fp.dsk
### Lazarus ###
# Lazarus compiler-generated binaries (safe to delete)
*.dll
*.so
*.dylib
*.lrs
*.res
*.dbg
*.o
*.or
*.a
# Lazarus autogenerated files (duplicated info)
*.rsj
*.lrt
# Lazarus local files (user-specific info)
# Lazarus backups and unit output folders.
# These can be changed by user in Lazarus/project options.
backup/
*.bak
lib/
# Application bundle for Mac OS
*.app/
# End of https://www.toptal.com/developers/gitignore/api/freepascal,lazarus

6
.idea/.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/misc.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="14" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/lazarus-tutorials.iml" filepath="$PROJECT_DIR$/.idea/lazarus-tutorials.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="firstproject"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="firstproject.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="firstproject"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2"/>
</Debugging>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,18 @@
program firstproject;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
begin
writeln('A Free Pascal progam');
{$IFDEF WINDOWS}
readln;
{$ENDIF}
end.

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="1">
<Unit0>
<Filename Value="firstproject.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<CursorPos X="11" Y="16"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
</Units>
<JumpHistory HistoryIndex="-1"/>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="pointer_project"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="pointer_project.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="pointer_project"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,20 @@
program pointer_project;
{$mode objfpc}{$H+}
type Plongint = ^longint;
var
anInt: longint = 243;
intPtr: Plongint;
begin
intPtr := @anInt;
WriteLn('The value of intPtr^ is ', intPtr^);
Inc(intPtr^, 4);
WriteLn('The value of anInt after Inc(intPtr^, 4) is: ',anInt);
{$IFDEF WINDOWS}
readln;
{$ENDIF}
end.

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="2">
<Unit0>
<Filename Value="pointer_project.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="38" Y="18"/>
<UsageCount Value="20"/>
</Unit0>
<Unit1>
<Filename Value="F:\Collector\unit1.pas"/>
<UnitName Value="Unit1"/>
<IsVisibleTab Value="True"/>
<CursorPos Y="34"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit1>
</Units>
<JumpHistory Count="1">
<Position1>
<Filename Value="F:\Collector\unit1.pas"/>
<Caret TopLine="27"/>
</Position1>
</JumpHistory>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="stortstrings"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="stortstrings.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="stortstrings"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2"/>
</Debugging>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,13 @@
program stortstrings;
{$mode objfpc}{$H+}
var testStr: string[10] = 'Lazarus';
begin
WriteLn('This shows testStr enclosed by square brackets [', testStr, ']');
WriteLn('testStr''s length is ', Length(testStr), ' characters');
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="1">
<Unit0>
<Filename Value="stortstrings.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<CursorPos X="11" Y="11"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
</Units>
<JumpHistory HistoryIndex="-1"/>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="simple_types"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="simple_types.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="simple_types"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2"/>
</Debugging>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,32 @@
program simple_types;
{$mode objfpc}{$H+}
const
pName='simple_types';
tab=#9;
var
smallInteger: SmallInt= -37;
started: boolean = false;
begin
WriteLn('This program is called ', tab, tab, '"', pName, '"', sLineBreak);
WriteLn('When initalised smallInteger has the value: ', smallInteger);
WriteLn('When initialized started has the value: ', started, sLineBreak);
smallInteger += 100;
WriteLn('After adding 100 to smallInteger its value is: ', smallInteger);
started:= not started;
WriteLn('Negating started gives it the new value: ', started, sLineBreak);
WriteLn('The highest value a SmallInt can store is: ', High(SmallInt));
WriteLn('The lowest value a SmallInt can store is: ', Low(SmallInt));
{$IFDEF WINDOWS}
readln;
{$ENDIF}
end.

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="1">
<Unit0>
<Filename Value="simple_types.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<CursorPos X="11" Y="30"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
</Units>
<JumpHistory HistoryIndex="-1"/>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,63 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasTitleStatement Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="string_functions"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="string_functions.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<Target>
<Filename Value="string_functions"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2"/>
</Debugging>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,22 @@
program string_functions;
{$mode objfpc}{$H+}
uses strutils, sysutils;
var st: string;
begin
WriteLn('Enter a word or pharase ([Enter] completes the entry)');
ReadLn(st);
WriteLn('You typed: ', st);
WriteLn('Your text converted to uppercase: ', UpperCase(st));
WriteLn('Your text converted to lowercase: ', LowerCase(st));
WriteLn('Your text converted to proper case: ',
AnsiProperCase(st, StdWordDelims));
WriteLn('Your text reversed: ', ReverseString(st));
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="1">
<Unit0>
<Filename Value="string_functions.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<CursorPos X="11" Y="20"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
</Units>
<JumpHistory HistoryIndex="-1"/>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

View File

@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<General>
<Flags>
<MainUnitHasCreateFormStatements Value="False"/>
<MainUnitHasScaledStatement Value="False"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="My Application"/>
<UseAppBundle Value="False"/>
<ResourceType Value="res"/>
</General>
<BuildModes Count="1">
<Item1 Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0"/>
</RunParams>
<Units Count="1">
<Unit0>
<Filename Value="typed_const.lpr"/>
<IsPartOfProject Value="True"/>
</Unit0>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="typed_const"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
</CompilerOptions>
<Debugging>
<Exceptions Count="3">
<Item1>
<Name Value="EAbort"/>
</Item1>
<Item2>
<Name Value="ECodetoolError"/>
</Item2>
<Item3>
<Name Value="EFOpenError"/>
</Item3>
</Exceptions>
</Debugging>
</CONFIG>

View File

@ -0,0 +1,28 @@
program typed_const;
{$mode objfpc}{$H+}
Function GetAName: string;
const lastName: string = '';
var constName: string = 'Lazarus';
begin
WriteLn('[Last name entered was "', lastName, '"]');
WriteLn('[Value of constName is "', constName, '"]');
Write('Enter a new name: ');
ReadLn(Result);
lastName := Result;
end;
begin
WriteLn('First invocation of GetAName');
WriteLn(GetAName);
WriteLn;
WriteLn('Second invocation of GetAName');
WriteLn(GetAName);
WriteLn;
WriteLn('[Finished]');
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectSession>
<PathDelim Value="\"/>
<Version Value="11"/>
<BuildModes Active="Default"/>
<Units Count="1">
<Unit0>
<Filename Value="typed_const.lpr"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit0>
</Units>
<JumpHistory HistoryIndex="-1"/>
<RunParams>
<FormatVersion Value="2"/>
<Modes Count="0" ActiveMode=""/>
</RunParams>
</ProjectSession>
</CONFIG>

12
simple_examples/Makefile Normal file
View File

@ -0,0 +1,12 @@
PROGRAMS_SRC = $(wildcard *.pas)
PROGRAMS_O = $(patsubst %.pas,%.o,$(PROGRAMS_SRC))
PROGRAMS = $(patsubst %.pas,%,$(PROGRAMS_SRC))
all:
$(foreach file, $(PROGRAMS), fpc -v0 ${file};)
clean:
rm -f $(PROGRAMS_O)
rm -f $(PROGRAMS)
.PHONY: all clean

View File

@ -0,0 +1,18 @@
program firstproject;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes
{ you can add units after this };
begin
writeln('A Free Pascal progam');
{$IFDEF WINDOWS}
readln;
{$ENDIF}
end.

View File

@ -0,0 +1,20 @@
program pointer_project;
{$mode objfpc}{$H+}
type Plongint = ^longint;
var
anInt: longint = 243;
intPtr: Plongint;
begin
intPtr := @anInt;
WriteLn('The value of intPtr^ is ', intPtr^);
Inc(intPtr^, 4);
WriteLn('The value of anInt after Inc(intPtr^, 4) is: ',anInt);
{$IFDEF WINDOWS}
readln;
{$ENDIF}
end.

View File

@ -0,0 +1,32 @@
program simple_types;
{$mode objfpc}{$H+}
const
pName='simple_types';
tab=#9;
var
smallInteger: SmallInt= -37;
started: boolean = false;
begin
WriteLn('This program is called ', tab, tab, '"', pName, '"', sLineBreak);
WriteLn('When initalised smallInteger has the value: ', smallInteger);
WriteLn('When initialized started has the value: ', started, sLineBreak);
smallInteger += 100;
WriteLn('After adding 100 to smallInteger its value is: ', smallInteger);
started:= not started;
WriteLn('Negating started gives it the new value: ', started, sLineBreak);
WriteLn('The highest value a SmallInt can store is: ', High(SmallInt));
WriteLn('The lowest value a SmallInt can store is: ', Low(SmallInt));
{$IFDEF WINDOWS}
readln;
{$ENDIF}
end.

View File

@ -0,0 +1,13 @@
program stortstrings;
{$mode objfpc}{$H+}
var testStr: string[10] = 'Lazarus';
begin
WriteLn('This shows testStr enclosed by square brackets [', testStr, ']');
WriteLn('testStr''s length is ', Length(testStr), ' characters');
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.

View File

@ -0,0 +1,22 @@
program string_functions;
{$mode objfpc}{$H+}
uses strutils, sysutils;
var st: string;
begin
WriteLn('Enter a word or pharase ([Enter] completes the entry)');
ReadLn(st);
WriteLn('You typed: ', st);
WriteLn('Your text converted to uppercase: ', UpperCase(st));
WriteLn('Your text converted to lowercase: ', LowerCase(st));
WriteLn('Your text converted to proper case: ',
AnsiProperCase(st, StdWordDelims));
WriteLn('Your text reversed: ', ReverseString(st));
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.

View File

@ -0,0 +1,28 @@
program typed_const;
{$mode objfpc}{$H+}
Function GetAName: string;
const lastName: string = '';
var constName: string = 'Lazarus';
begin
WriteLn('[Last name entered was "', lastName, '"]');
WriteLn('[Value of constName is "', constName, '"]');
Write('Enter a new name: ');
ReadLn(Result);
lastName := Result;
end;
begin
WriteLn('First invocation of GetAName');
WriteLn(GetAName);
WriteLn;
WriteLn('Second invocation of GetAName');
WriteLn(GetAName);
WriteLn;
WriteLn('[Finished]');
{$IFDEF WINDOWS}
ReadLn;
{$ENDIF}
end.