I created a Test
class which has an instance variable @val
and which is defined inline.
class Test
@value = 10
def display
puts @value
end
end
t = Test.new
t.display
This gives no output. But if I set @val
through initialize method then the code works.