Conditionally execute (if-else without else)

I'd like to request some GUI sugar for if-else statements. Basically, what I'd like to have is this:

Use case: I often find that my global macro needs to be disabled when yet another app has focus. (I can't use macro groups because I switch things around a lot and I'd rather have duplicate macros than duplicate macro groups)
Means I end up having an if-else-statement but don't need the else case.

On behalf of OCD and a prettier GUI, can I get an if statement without an else case? :smiley:

Just leave the else case empty, and the conditional will either do something (if) or nothing (else).

I know, but if I unfold it, the else case still takes up the extra space. Hence - cosmetic, I know :slight_smile:

Just undisclose the otherwise section:

Then it is only taking up one line.

@manavortex, I understand and sympathise with your feelings towards the visual of an empty else block that can be irrationally unsettling. I avoid if...then...else actions where possible for this reason, and favour switch, which caters for a single case. They aren't completely interchangeable in all scenarios, but are adaptable in most situations. The other action I use to circumvent a lonely if is an assert, which tests for the same condition that if would pass, terminating the macro upon failure, which is the equivalent of an else block that doesn't have any content (in situations where the macro doesn't have to then go on to do other things).

1 Like