As we see the parameter is evaluated both times so this code will be optimal if we pass our parameter by value. You must decide when you want to use parameter by value and when parameter by name in your code