D
di vi
I declared two files.One to hold the value of a global variable.And the
other to print it.
1)to hold variables (var.rb)
Code:
$foo = 500
2) to print the global variable (gprint.rb)
Code:
loop do
puts $foo
end
But when I print it ,I get the value "nil" being printed not 500.What
could be the problem?
I did read some tutorials online but dint help.Could some please tell
why I am not able to access the global variable between two .rb files in
the same folder?
Please let me know.
other to print it.
1)to hold variables (var.rb)
Code:
$foo = 500
2) to print the global variable (gprint.rb)
Code:
loop do
puts $foo
end
But when I print it ,I get the value "nil" being printed not 500.What
could be the problem?
I did read some tutorials online but dint help.Could some please tell
why I am not able to access the global variable between two .rb files in
the same folder?
Please let me know.