What does "A type cannot be be used as a standalone statement" error mean?
This is Delphi Prism for .NET. I am running into this error(s), "A type cannot be be used as a standalone statement", and I don't understand or know why. The compiler is pointing at the lines right below var keywords.
method ScriptDlgpas.ExecuteStartup;
var
sname:string; <------ error raised here
slist:ArrayList; <------ error raised here
begin
sname := basedir+'system\startup.scr';
if File.Exists(sname) then
be开发者_开发问答gin
slist := new ArrayList;
ExecuteScript(slist);
end;
end;
The Google Search isn't helping either.
Thanks in advance.
There's probably something above it that doesn't get closed properly.
Try inlining the variables (reducing scope is a good thing btw.):
method ScriptDlgpas.ExecuteStartup;
begin
var sname := basedir + 'system\startup.scr';
if File.Exists(sname) then
begin
var slist := new ArrayList;
ExecuteScript(slist);
end;
end;
精彩评论