I want to assign a number to an internal variable, depending if a specific option has been given, but it seems to fail. Something like:
paropts={a->1, b->2, c->3}
myFunction[t, opts:OptionsPattern[paropts]]:=
With[{If[OptionValue[a],x=a/t,x=1/t]},y=x+OptionValue[c]]
I know the syntax is quite wrong here, but I just want to show the concept. If the option "a" is given then use it to calculate x, otherwise use only 1/t.
That means the function should able to work also if at the beginning my opts are:
paropts={b->2, c->3}
I want to do it as easy as possible and other forms I have tried do not work. I also need to keep the structure of the paropts rules as I have them now, because I use them in many other functions.
It would also be helpful to do it with Block
or something else.
Thanks,
S