Shortcuts & logic
2024-08-14 00:00
The thing I hate-enjoy the most about making Apple Shortcuts is how it encourages (because it lacks real complex logic or data structures) to write logic that takes shortcuts and kind of avoids checking all cases. Like with what I was doing when I got this post idea:
- Two variables (a and b) that can have three states: Green, Yellow, Red.
- Where the global state should be Red if either is Red, or Yellow if either is Yellow otherwise Green
- Easy with a or something more fancy like a data structure that holds the results for each possible state
- With Shortcuts I always find myself doing something like this
- Set Status to A
- Then a shit load of nested if
- If Status != Red
- If B != A
- If B != Green
In the same way you would in places where performance is very important and you only do what you have to do.
I could have re-written it to be numbers and found the largest ones, and then converted that to the statuses. But that isn’t really the point here: can we have some real if logic soon?!