Tests for a nil (unassigned) pointer or procedural variable.

解决方案 »

  1.   

    你的判断是正确的。但它也有别的用处。
    如果login窗体已经close了,但是flogin变量还可能是不为空的,所以如果使用flogin = nil去判断的话,可能会得到不正确的答案,因此可以使用assigned去判断flogin是否为空。
      

  2.   

    Assigned函数是用来判断里面的对象是否存在,如
    var P: Pointer;
    begin
      P := nil;
      if Assigned (P) then Writeln ('You won''t see this');
      GetMem(P, 1024); {P valid}
      FreeMem(P, 1024); {P no longer valid and still not nil}
      if Assigned (P) then Writeln ('You''ll see this');
    end;