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.