The IF function picks between two values based on a condition: IF(condition, valueIfTrue, valueIfFalse). With it, parts of a design can respond to what users enter.
Show or hide an element. Connect an element's Visibility to a true/false value. With a checkbox whose variable is showBadge, just use showBadge: the element appears only when the box is ticked. The IF form IF(showBadge, true, false) does the same thing and is handy when the condition is more involved.
Switch a value. Change a colour based on a choice:
IF(isDark, `#ffffff`, `#000000`)
This sets text white on a dark theme and black otherwise.
Test a condition. The condition can be a comparison like price > 100, or a check such as IS_EMPTY_STRING(subtitle) to hide a subtitle when it is left blank. For more than two outcomes, nest one IF inside another or use the SWITCH function.