Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Inno Setup Scripting (Pascal), how do you set a global variable's initial value?

(I'm pursuing Inno Setup scripting, but my understanding is that the [Code] section uses Pascal syntax, or a close approximation. I know zero about Pascal or its standard conventions, so apologies in advance for my ignorance.)

When defining a function/procedure's local variable, syntax for defining its initial value isn't such an issue...

procedure MyProcedure();
var
    aFlag: Boolean;
begin
    aFlag := true;
    .
    .
    .
end;

But I'm hard-pressed to figure out how the initial values for global variables are handled. For example, if I want a global Boolean variable to start out as true instead of false (the default), how would I go about accomplishing that?

Thanks!

like image 268
Syndog Avatar asked Feb 16 '12 10:02

Syndog


1 Answers

Define them inside the code block outside of a procedure:

[code]
var 
  wibble: boolean;
  wobble: string;
  ...

and you can set their initial values in the initialize event;

procedure InitializeWizard(); 
begin 
    wibble := true;
    wobble := "hello";
...
like image 151
Alex K. Avatar answered Oct 14 '22 17:10

Alex K.