add nested function examples with scoping