[lazarus] "Variant" variable ?

Michael Van Canneyt michael.vancanneyt at wisa.be
Thu Apr 27 03:29:24 EDT 2000




On Thu, 27 Apr 2000, Marc Weustink wrote:

> At 23:20 26-04-2000 +0200, Michael Van Canneyt wrote:
> 
> >It is in the Case statement.
> >
> >Case A : Integer of
> >   1 : (X : String;);
> >   2 : (Y : Longint);
> >end;
> >
> >If A=1 then you can access X as a string
> >If A=2 then you can access Y as a Longint.
> 
> Is there a check on this? I allways thought that 1 and 2 are just 
> placeholders?

There is no check; you must do the check. The point is that there are 2 constructs

Case A : Integer of
   1 : (X : String;);
   2 : (Y : Longint);
end;

Here you can set A and thus have an indication which of X or Y you should access.
(i.e. A is a normal field of the record)

On the other hand

Case Integer of
   1 : (X : String;);
   2 : (Y : Longint);
end;

doesn't allow to determine what you should access, because there is no 'A' field.

Michael.
> 
> Marc
> 
> 
> 
> 
> _________________________________________________________________
>      To unsubscribe: mail lazarus-request at miraclec.com with
>                 "unsubscribe" as the Subject
>     archives at http://www.miraclec.com/list_archives/lazarus
> 






More information about the Lazarus mailing list