type TPoint = record
Name: string;
X:Double;
Y:Double;
end;function FindPointByName(points: TPointArray; name: string): TPoint;
var
i: integer;
begin
for i:=Low(points) to High(points) do
begin
if SameText(points[i].Name,name) then
begin
result := points[i];
break;
end;
end;
end;上述代码,如果未找到值,结果用什么判断?(不能用FindPointByName(points,'a')=nil来判断吧?)
请指教,谢谢。
Name: string;
X:Double;
Y:Double;
end;function FindPointByName(points: TPointArray; name: string): TPoint;
var
i: integer;
begin
for i:=Low(points) to High(points) do
begin
if SameText(points[i].Name,name) then
begin
result := points[i];
break;
end;
end;
end;上述代码,如果未找到值,结果用什么判断?(不能用FindPointByName(points,'a')=nil来判断吧?)
请指教,谢谢。
record 类型,可以与''比较???
var
i: integer;
BFind:Boolean;
begin
BFind := False;
for i:=Low(points) to High(points) do
begin
if SameText(points[i].Name,name) then
begin
result := points[i];
BFind := True;
break;
end;
end;
if (not BFind) then
result := nil;
end;