Adding another return node will instantly solve the problem.
The blueprint should exactly work as the code you posted there.
If the condition is not met, it would basically return the float as 0 without the need to define a extra local variable . Like having a virtual return node.