variable-scope

Learning C# Issues with Array (Array Data Vanishes)

This is likely a scoping issue but the following code dies. I build a multi-dimensional array from 2 classes, Cell and Map. The map is an X by Y sized grid of Cells. Pretty normal so far (I keep re-writing this same program when I learn a new language). For brevity I'll just post the classes and a basic test that reflects the error. When...

Problems trying to access to a global var

Hi, I know how to use the global variables when they are defined in a class, but I have a global variable in a main. If I want to use it inside a class, which would be the import to access it? My main is something like this Main.py: from EvolutionaryAlgorithm import EvolutionaryAlgorithm initialTimeMain = 0 if __name__ == '__main__':...

Multiple ScriptControl instances sharing variable

I have a ScriptControl that uses an image as an embedded resource and GetWebResourceUrl to generate the WebResource.axd URL. I am currently using GetScriptDescriptors() to send the URL to the JavaScript object. The ScriptControl can be in a Repeater, so you may have 20+ instances. They all use the same images (not customizable through...

jQuery: Basics - Variable Scope Issue

I've hunted around for about an hour or so trying to glean whatever I could about variable scope in jscript/jquery and by all accounts, my code should work. Right now I just want to be able to read a global variable from a function. My code isn't working and right now it's very basic. Eventually I will need to manipulate the global va...

php: get variables visible in function

is there any way to get list of variables that were defined in function, or list of all accessible variables in a function? ...

JavaScript Access Local Variable with Same Name in Inner and Outer Scope

Given the following JavaScript: var someFunction = function(id) { //do some stuff var modifyId = function(id) { //do some stuff outer.id = id; //is there any way to modify the id variable in the outer scope from here? } } How do you modify the id passed into the outer function scope from within the inner function scope...

Howto make a var. name with a var. in C/C++?

Hi, i have some vars live: int foo1; int foo2; .. and i want to reach them from: for (int i = 1;i<=2;i++) { // howto get foo1 and foo2? } how to get them? EDIT, end what when it will be no int but a Opject *pointer;? ...

Class variable within its definition?

This is probably a dumb question. I am trying to make a text-mud. I need each Room class to contain other Room classes that one can refer to when trying to move to them or get information from them. However, I can not do that because I obviously can not declare a class within its definition. So, how do I do this? Here's what I mean when ...

Javascript: Scope of a Variable across different Javascript files

Hi, I defined a variable in one of my JavaScript files. I want to access the value of that variable among JavaScript files. In one file I am initializing the value of that variable. I cannot access the assigned value in another JS files. Is there anything that I am missing ? ...

Help with Javascript scope

This example is a simplified version of my code. I'm still trying to grasp the new way of writing javascript (as opposed to the way 10 years ago) so thanks for your patience. I need globalVal's value to be accessible and I'm having trouble. The value is obtained from a function that is called as an argument from another method. The examp...