Option _Explicit Keyword(s) of day XXX:
#24
The thing going on about "x2" in the second example just above is good for programmers who don't want to give outlandish names to variables. With OPTION _EXPLICIT and the DIM SHARED going down for "x2", it's actually being protected in the subprogram by the local "x2". Yes sometimes this could get in the way, but some programmers appreciate something like this. There is nothing to do about it except create a parameter for the subprogram and pass the global "x2" as that parameter. Then the value of global "x2" could be changed or not as you (the programmer) decides.

Be glad we're programming in BASIC and not eg. in Python where it is required to tell the interpreter which variables are global inside a function definition.
Reply


Messages In This Thread
RE: Option _Explicit Keyword(s) of day XXX: - by mnrvovrfc - 06-09-2023, 07:06 PM



Users browsing this thread: 1 Guest(s)