From: Nick Brown Date: 2010-02-28T06:21:30+09:00 Subject: scope question Consider the following Sinatra app: require 'sinatra' vara = "foo" VARB = "bar" helpers do def geta vara end def getb VARB end end get '/a' do geta end get '/b' do getb end When I run that and browse to /b, it displays "bar". When I browse to /a, however, it produces the error: "undefined local variable or method `vara'". Why do these two variables differ in scope? How can I declare a variable that has global scope but is not a constant? Thanks in advance... -- Posted via http://www.ruby-forum.com/.