## Pascal samples. Variant types.

#### Example 1

>     uses
>       Variants;
>     var
>       V1, V2: Variant;
>       I: Integer;
>       S: String;
>       WS: WideString;
>       c: Char;
>       D: Double;
>     begin
>       V1 := 'abc';
>       writeln(V1);
>       S := 'pqr';
>       V1 := S;
>       writeln(V1);
>       WS := 'xyz';
>       V1 := WS;
>       writeln(V1);
>       V2 := V1;
>       writeln(V2);
>       c := 'g';
>       V1 := c;
>       writeln(V1);
>       I := 5;
>       V1 := I;
>       writeln(V1);
>       V1 := 0.5;
>       writeln(V1);
>       D := 0.3;
>       V1 := D;
>       writeln(V1);
>       S := V2;
>       writeln(S);
>       WS := V2;
>       writeln(S);
>       D := V1;
>       writeln(D);
>       V1 := 3;
>       I := V1;
>       writeln(I);
>       V1 := true;
>       writeln(V1);
>       writeln(VarType(V1));
>     end.

#### Example 2

>     uses
>       Variants;
>     var
>       V: Variant;
>     begin
>       V := VarArrayOf([10, 20, 30]);
>       writeln(V[1]);

>       V := VarArrayCreate([0, 5], varInteger);
>       V[2] := 5;
>       writeln(V[2]);
>     end.

Copyright © 2006-2008 VIRT Laboratory. All rights reserved.