Seting a Pad inside an If block

Hello,

I often need to modify a variable based on a condition.
When this happens, I use an If block for the conditional part, but because it has its own scope we can’t set the pad inside. So I have to add a switch just after to only set the pad when the if is triggered.

I find this kinda ugly, but often have to do something like this.
Only solution I’m thinking about is having this whole thing as its own operation and only call it when there is the trigger; that way we still have access to the Pad without this ugly switch.
But it means adding an operation which may not be wanted when patching around.

In regular C# we can do if and set variable inside because the scope is shared.

Am I missing any obvious way of doing this?
Thanks

Maybe I am missing the point of this question, but for me this works fine:

An alternative way is to use the Apply for any Operation (method) something like this

1 Like

Just re-read my post and the answers, and I clearly wasn’t thinking straight when I posted, sorry for the confusion.

I am trying to understand why I run into such issues because there clearly aren’t any lol..
And the switch doesn’t add anything to the if logic because it’s already a passthrough when the condition is off.

Well, sorry again!