Tampilkan postingan dengan label variant. Tampilkan semua postingan
Tampilkan postingan dengan label variant. Tampilkan semua postingan

Jumat, 30 April 2021

Penggunaan unit system Variants dan cara mengetahui jenis variabel

var
  LVar: Variant;
 
begin
  { Assign a byte value to the variant. }
  { Prints out "Byte" to the console. }
  LVar := 100;
  Writeln(VarTypeAsText(VarType(LVar)));
 
  { Multiply the byte value by 1000. This results in an Int64 with a value of 100000. }
  { Prints out "Int64" to the console. }
  LVar := LVar * 1000;
  Writeln(VarTypeAsText(VarType(LVar)));
 
  { Divide the LongWord value by 5.0. This results in a double value. }
  { Prints out "Double" to the console. }
  LVar := LVar / '5.0';
  Writeln(VarTypeAsText(VarType(LVar)));
  Readln;