mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 18:09:27 +02:00
+ Added example 83 for assigned function
This commit is contained in:
parent
26e2e72ad3
commit
314127b513
@ -38,7 +38,7 @@ OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex13 ex14 \
|
||||
ex41 ex42 ex43 ex44 ex45 ex46 ex47 ex48 ex49 ex50 ex51 ex52 ex53 \
|
||||
ex54 ex55 ex56 ex57 ex58 ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 \
|
||||
ex67 ex68 ex69 ex70 ex71 ex72 ex73 ex74 ex75 ex76 ex77 ex78 ex79 \
|
||||
ex80 ex81 ex82
|
||||
ex80 ex81 ex82 ex83
|
||||
|
||||
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))
|
||||
|
||||
|
@ -85,3 +85,4 @@ ex79.pp contains an example of the SetJmp/LongJmp functions.
|
||||
ex80.pp contains an example of the High/Low functions.
|
||||
ex81.pp contains an example of the HexStr function.
|
||||
ex82.pp contains an example of the BinStr function.
|
||||
ex83.pp contains an example of the Assigned function.
|
||||
|
31
docs/refex/ex83.pp
Normal file
31
docs/refex/ex83.pp
Normal file
@ -0,0 +1,31 @@
|
||||
Program example83;
|
||||
|
||||
{ Program to demonstrate the Assigned function }
|
||||
|
||||
Procedure DoSomething;
|
||||
|
||||
begin
|
||||
Writeln ('Hello from doseomething!')
|
||||
end;
|
||||
|
||||
Type
|
||||
TProcType = Procedure;
|
||||
|
||||
Var P : Pointer;
|
||||
Procvar : TProcType;
|
||||
|
||||
begin
|
||||
P:=Nil;
|
||||
If not Assigned(P) then
|
||||
Writeln('P is nil');
|
||||
Getmem(P,1000);
|
||||
If Assigned(P) Then
|
||||
writeln ('P Points in the heap.');
|
||||
FreeMem(P,1000);
|
||||
procvar:=@DoSomething;
|
||||
If Assigned(ProcVar) then
|
||||
Writeln ('Procvar is non-nil');
|
||||
procvar:=TProcType(Nil);
|
||||
If Not Assigned(Procvar) then
|
||||
Writeln ('Procvar is nil');
|
||||
end.
|
Loading…
Reference in New Issue
Block a user