Global vs Local behaviour
|
05-02-2015, 03:24 PM
Post: #1
|
|||
|
|||
Global vs Local behaviour
The use of a command line entry "global" variable would make the contents available for other activities when a program concludes. As implemented, there is a problem with this reasoning, because a program that passes a value in via the command line, automatically makes that input variable "local" in context. Here is an example:
Code:
The global variable retains its programmed contents, remaining available at the end of run time. Suppose its desired to pass parameters via the command line: Code:
In this example, the global variable, stg, gets displaced by a local (same name) variable during input. Any programmatic effect on stg vanishes once the program terminates. If the "command line input" were to initially check for the 'global' existence of its variable, I think it would enhance the process of parameter passing via the command line. What do other users think about this? |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Global vs Local behaviour - DrD - 05-02-2015 03:24 PM
RE: Global vs Local behaviour - kharpster - 05-02-2015, 08:38 PM
RE: Global vs Local behaviour - DrD - 05-02-2015, 09:56 PM
RE: Global vs Local behaviour - kharpster - 05-02-2015, 10:29 PM
RE: Global vs Local behaviour - DrD - 05-03-2015, 02:18 AM
RE: Global vs Local behaviour - kharpster - 05-03-2015, 08:33 PM
RE: Global vs Local behaviour - cyrille de brébisson - 05-04-2015, 04:41 AM
RE: Global vs Local behaviour - DrD - 05-04-2015, 11:34 AM
RE: Global vs Local behaviour - Didier Lachieze - 05-04-2015, 01:32 PM
RE: Global vs Local behaviour - DrD - 05-04-2015, 01:47 PM
RE: Global vs Local behaviour - leprechaun - 05-04-2015, 05:47 PM
|
User(s) browsing this thread: 1 Guest(s)