How in Ruby do you go about accessing a variable from the outer scope? The following doesn't compile, but I can't quite figure out how to access the variable, short of sending it as a parameter to the functions:
def sqrt(x)\n   def good_enough(guess)\n      return abs(square(guess) - x) < 0.001\n   end\n\n   def improve(guess)\n      return average(guess, Float(x) / guess)\n   end\n\n   def sqrt_iter(guess)\n      if (good_enough(guess))\n         then return guess\n         else return sqrt_iter(improve(guess))\n      end\n   end\n\n   return sqrt_iter(1.0)\nend\n

Thanks.