I have a situation where I'm dealing with couple of methods.I'm confused how to pass parameters and arguments for them. I initially have these two methods let's say -
def method_foo1 classes_prod, classes_corp, run_user, application
set_name_prod = ... // declaring variable
all_classes_prod = ... //declaring variable
method_foo3 set_name_prod, all_classes_prod, run_user , application //calling method 3
end
I'm introducing a second method which also calls method_foo3 from body of it but now it should pass only three arguments.Something like below -
def method_foo2 account_id,application
account_id_prod = .... // declaring variable
method_foo3 account_id_prod, application // //calling method 3
end
Now the main method/ method_3 which method_1 & method_2 are calling -
def method_3 set_name,classes,run_user,application
..... //body of method_3
end
As, we can see the method_3 has only 4 parameters available previously. Now I want to introduce a parameter "account_id" along with the rest. And make sure "classes" , "run_user" & new parameter "account_id" optional as they're not mandatorily being called from method_1 and method_2. How can I do this ?Any help is really appreciated.
I basically want to skip few parameters when they don't get any value and make sure the exact argument goes to exact parameter.