Fetching contributors…
Cannot retrieve contributors at this time
executable file 27 lines (22 sloc) 857 Bytes
program Variant_Example;
V: Variant; // 'V' is a nice, non-confusing name for a Variant :)
S: String; // Same as 'S' for a string.
V := 10; // Variant's can be an integer.
V := 'hello'; // ..or a string!
V := 16.9; // Even an extended type!
S := V; // Notice above how I didn't convert a variant to a string type.
// The variant process of setting variables is like this.
// 1) Is the variable the same type as what I currently am (Integer, String, Boolean, etc)?
// 1a) If not, call a conversion method.
// 2) Set the variable.
// +=+=+=+=+
// In this case, the process is as follows:
// 1) It is *not* the same type, it is an extended by I am a string.
// 1a) Do a FloatTostr on it to make it a string.
// 2) Set S to be equal to '16.9'.