[Pas2js] how to access variables between various procedures
Michael Van Canneyt
michael at freepascal.org
Tue Sep 15 12:19:36 CEST 2020
On Tue, 15 Sep 2020, Mgr. Janusz Chmiel wrote:
> Can be global variable declared by using public directive?
Just add
var a : Integer;
after the implementation keyword in your unit.
> But When i have
> tried to use public yesterday I had no chance and I have got also error.
> I have only tried to simply have a variable which would work as a counter.
> So when user answer right question, The right answer whould be counted by
> using a=a+1.
> But I know, that I must respect The characteristics of object Pascal
> programming, because I can not mix non object based programming with object
> one.
You can, you just need to use the right location for your variable.
Michael.
More information about the Pas2js
mailing list