This simple search statement works only if one is sure that there is at least one person with Height equal to 175 on the list. But is this realistic? A check for failing to find 175 before reaching the end of the list is mandatory unless you can guarantee it. We might first try the following solution: 

Pt := First; while (pt <> nil) and (Pti.Height <> 175) do Pt := Pti.Next 

But recall Section 4.A. If Pt = nil, the variable Pt i, referenced in the second factor of the termination condition, does not exist at all, and referencing it is an error. The following are two possible solutions which treat this situation correctly: 

(1) Pt:= First; B := true while (Pt <> nil) and B do if pti.Height = 175 then B .- false else Pt := Pti.Next (2) Pt:= First; while Pt <> nil do begin if pti.Height Pt .- Pti.Next end; 13: 175 then goto 13; 

## 10.B. New and Dispose 

To pose another problem, say we wish to add the sample person to the data base. First a variable must be allocated, and its identifying value obtained by means of the predeclared procedure New. 

New (P) a procedure that allocates a new identified (dynamic) variable pi having as its type the domain type of P, creates a new identifying pointer value having the type of P, and as­ signs it to P. If pi is a variant record, New (P) allocates enough space to accommodate all variants. 

New(P,Cl, ... ,Cn) allocates a new identified (dynamic) vari­ able pi having the variant record type of P with tag field val­ ues C 1, ... , Cn for n nested variant parts, creates a new identifying pointer value having the type of P, and assigns it to P. 

