Skip to content

08. Wildcards use to simulate an "OR" logical operator

sergiodinapoli edited this page Sep 11, 2021 · 1 revision

Consider this example:
<li>r_logentry(INITIATOR_trait==sanguine)->The world is a wonderful place!</li>
<li>r_logentry(INITIATOR_trait==optimist)->The world is a wonderful place!</li>

This coding is perfectly valid, although repetitive and clumsy (especially if you consider writing several lines for the sanguine and optimist cases, not just one as in this example).

It'd be wonderful to have something like this:
<li>r_logentry(INITIATOR_trait==sanguine||INITIATOR_trait==optimist)->The world is a wonderful place!</li>

That is, it'd be wonderful to have an OR explicit operator (here imagined by me as "||"). But there is no such thing available, unfortunately.

Yet, luckily, wildcards come to our help:
<li>r_logentry(INITIATOR_trait=sanguine)->[optimistic_traits]</li>
<li>r_logentry(INITIATOR_trait=optimist)->[optimistic_traits]</li>
<li>optimistic_traits->The world is a wonderful place!</li>

This snippet works as an OR operator.
Moreover, it saves time and helps consistency: suppose later on you decide that "The world is a wonderful place!" sentence needs to be changed, you can change it just once in the 3rd line instead of changing it twice in the previous repetitive example.
Also: since you type less, you are less likely to end up with a typo and create inconsistencies.