J
Junkone
what is the meaning of the $ in the variable
$tws = Twslinkrb::TWSLinkWrap.new(1)
$tws = Twslinkrb::TWSLinkWrap.new(1)
Junkone said:what is the meaning of the $ in the variable
$tws = Twslinkrb::TWSLinkWrap.new(1)
It marks the variable as global.
Junkone said:how do global instance variables work.
There's no such thing.
If a var starts with $, it's global, if it starts with @ it's an instance var.
It can't be both.
HTH,
Sebastian
Junkone said:ok. if i have $something, is it available to all the objects withtin
the program.
i have opened $something
a.method invoks b.method.
does $something be available inside b.method without passing it.
It is really totally global. You can access any global var from any
method.![]()
In many cases though, you will find that in "typical" ruby code there is
not really the need to use many global variables (but instead local, and
@instance vars)
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.