Example - Use a variable value in a conditional IF

Share your macOS, iOS, and iPadOS shortcuts here. Post your shortcut in a new topic and be sure to describe thoroughly (screenshots, full text of any scripts, apps used, etc).
User avatar
jay (support)
Site Admin
Posts: 19202
Joined: Wed Mar 19, 2008 11:52 am
Location: Austin, Texas
Contact:

Example - Use a variable value in a conditional IF

Post by jay (support) »

I've just posted an example shortcut in the Library that illustrates how to get a variable, then use the variable value in an IF statement in a Shortcut. This turns out not to be as obvious as one might think. The key is that you have to explicitly tell the IF condition what the type of the value being compared against is. And (in a bout of exceedingly poor design), you can't do that in the IF condition itself, but rather in the statement before the IF you have to convert it. This shortcut shows you how to do that.

Note, there are probably other ways of doing it as well - I'm no shortcut expert, but here is one way of doing it.
Jay (Indigo Support)
Twitter | Facebook | LinkedIn

Return to “Apple Shortcuts”