Switch VS Branch

This is a topic that have been debate over and over between programmer when they have too much free time between their project. Basically, it perform is pretty much the same, the different is hardly noticeable with current hardware. On my personal experience, i use switch when i have to deal with enum or situation when program have limit choice and there won’t be new logic need to be consider, and if for the other cases.
Overall, use anything you are more comfortable with.

I’m just curious which is better to use overall? Is there any reason I should use a branch over a switch when both are applicable, other then tidiness I guess? Is a switch less or more performance effective then a branch? Which is optimum for performance I guess is what I’m trying to ask…What is the general difference? Is a switch direct while a branch is indirect? Or is a switch just a tidier version of a branch?

I am currently using it for an enum with 4 values, but there’s a couple times in my blueprint where I only need to distinguish between 2 of the values, I either am or I am not. Would it be better to use switch or branch here? From a professional correctness standpoint.

If it is only 2 values, then i guess an if node would be better. And no, i am nowhere near the professional level, still got tons of stuff to learn.

The reason I ask is I was told to avoid branches by a senior rendering engineer.

branches are a form of logic. If we avoided main logic it would be very difficult to produce things. There is nothing wrong with branches as they are the “basic” from of “IF…THEN…” If you can complete a task not using a branch then all the power to you, but switches encompass more evaluation than a branch does in my opinion.

Well, my senior suggest me to prefer branches over switch, guess that mean we will have a … senior battle?