Vellingiri Arul wrote: > Hai friends, > Please anybody can answer this question. > What is mean by scope in ruby. > > A scope is the portion of your code in which a variable can be given a value and then retrieved. num = 10 puts num + 1 #11 def func puts num + 2 end puts num + 3 #13 func #Error The variable num is defined within a scope that includes all the areas outside of the method definition func. However, inside the func method, num is not "in scope" because the method definition creates a new scope: def func num = 10 puts num + 5 end func #15 puts num + 6 #error -- Posted via http://www.ruby-forum.com/.