I’d like to make a function with two mutually exclusive arguments, like the slice method on arrays, which takes begin and end or count as arguments. I’d like to make a function to define two boundary dates with either two datetime or a datetime and a duration. The last datetime would be mutually exclusive with the duration.
Is there a built-in way to define mutually exclusive arguments ?
… or something like that, I didn’t check closely for syntax errors computing both “variants” of the second parameter is of course only a suggestion.
If you had a variable number of parameters, I’d recommend ..args for those. You’d likewise use some ifs inside the function to normalize the parameters, but the checking would probably get a bit more complex.