evet yapabilirsin, nested function olarak aratabilirsin

şöyle bir örnek işine yarayabilir

http://stackoverflow.com/a/7367757/1022138