RAD Studio (Common)
ContentsIndex
PreviousUpNext
E2071: This type cannot be initialized

File types (including type Text), and the type Variant cannot be initialized, that is, you cannot declare typed constants or initialized variables of these types.

program Produce;

var
  V: Variant = 0;

begin
end.

The example tries to declare an initialized variable of type Variant, which illegal.

program Solve;

var
  V: Variant;

begin
  V := 0;
end.

The solution is to initialize a normal variable with an assignment statement.

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!