"if" in a Shader Graph?

Well, the Branch node of Shader Graphs is not really the same Branch that in programmation: the “if()” in Shader scripts. It has boolean inputs instead of boolean outputs.

How to do a real branch in a Shader Graph?

Keywords

Keywords are a special type of variable. On the surface, they look like a normal Boolean property that you would use in a Branch node. However, they allow you to create variants of a shader, so that the engine compiles different shader versions for each branch. This is more efficient at runtime than having a Branch node where both branches are fully executed. The tradeoff is in compile time as each the number of variants grows exponentially with each keyword.