ravi
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2010
05:15 AM
Global Variables concept
Hi is there a way store the variables globally.
I mean to say If i declare a variable I want access it in all functions.
Presently to access the values in different functions Iam writting below code.Plz suggest is this Correct method
is this way correct.Plz suggest me.....
I mean to say If i declare a variable I want access it in all functions.
Presently to access the values in different functions Iam writting below code.Plz suggest is this Correct method
function one()
{
m.variable=1
}
function two()
{
print m.variable 'output is 1
}
is this way correct.Plz suggest me.....
2 REPLIES 2
Naveed_Anjum
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2010
05:25 AM
Re: Global Variables concept
If you want to use a variable that is accessed throughout your file say "Test.brs", then the code that you mention above is true. I dont know about the application wise global variables..

RokuKevin
Visitor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2010
10:10 AM
Re: Global Variables concept
There are no global variables, but there is a "global m scope".... Meaning that the scope of m that is not in an object scope is shared by all static functions that are not part of an object. This is the scope of the Main() function.
so...
Function Main()
m.variable = 100
.....
End Function
Function One()
m.variable = 1
End Function
Function Two()
print m.variable 'output is 1
End Function
If this is not working for you, check that One() and Two() are not methods of different objects....
so...
Function Main()
m.variable = 100
.....
End Function
Function One()
m.variable = 1
End Function
Function Two()
print m.variable 'output is 1
End Function
If this is not working for you, check that One() and Two() are not methods of different objects....