As noted in the Variables Overview, all variables have a type.
Variables of primitive types (such as String, Int, Real, and so on) always have a default value (as described in Initializing Variables). On the other hand, variables which have a non-primitive type have special initialization rules.
In this section, we will discuss how to explicitly initialize non-primitive variables.
The difference between the two categories is that the first has a special method called a constructor, which is used to create new instances of the component. The second does not.
Constructors are methods that are named after the component, and may or may not have arguments. If the constructor of a component does not have arguments, it is called the default constructor.
variable = [Module.]ComponentName([[{argument name}:]{value}[,...]])
Note that the names and types of arguments depend on the component and on the constructor you are calling.
configFile as TextFile
configFile = TextFile(name : "/home/config.props")
for each line in configFile.lines do
//Process the lines...
end
In the example above, on the first line, a local variable named configFile of type TextFile is declared, and on the second line it is initialized using TextFile's constructor, passing a file name as an argument.