Is there a way to dynamically switch/select between 2 different material attributes in the Material Editor?

I get an error trying to use an “If” in a Material Function that returns material attributes based on inputs.

I could use a material blend function with zero or one as the alpha, but I imagine going through all the lerps and fetching the values for both MA’s would have a performance impact.

The only other way I can think of doing this would be using a Branch in a custom code node, but I’m not sure how to reference material attributes in those.

Is there anything I’m missing, or is this just not done?