When I define a function outside the function, I cannot access the glide parameter: Hence, I have did something like that: I want to know if it is hack or good practice? Is there more convenient way for doing this. Answer Having the function outside is better. Mainly for readability and testing, but if your function is called a lot