Optional parameter in a function

https://learninghub.kx.com/forums/topic/optional-parameter-in-a-function

Is there a way to have an optional parameter in a function, and if this parameter is not supplied the function logic will behave differently?

I would want the function to act like the below.

func:{[requiredParam;requiredParam2;optionalParam]

              logic if optionalParam is supplied

              logic if optionalParam is not supplied}

The way you can solve this is by using a dictionary as parameter, mapping each parameter name as key to a value. You can then check if a certain parameter is in the parameter names (using key). This also allows you to pass more than 8 parameters to a function