Suppose you would like to write a sentence something like one of the following, depending on the age of a child:
My child <ChildName>
is a teenager and is allowed to watch movies rated for 13 and older.
OR
My child <ChildName>
is not a teenager but in any case, being <Age>
, is old enough to be allowed to watch movies rated for 13 and older.
OR
My child <ChildName>
is not a teenager.
Assume you have a data element Age which has the child’s age. Deciding on whether the child is a teenager or not is a matter of querying whether Age is between 13 and 19, both included.
Here’s how you would do it – notice the use of ‘or’ inside the first condition:
My child
«ChildName»
is«If(Age < 13 or Age > 19)»
not«End()»
a teenager«If(Age >= 13)»«If(Age > 19)»
but in any case, being«Age»
,is old enough«Else()»
and is allowed«End()»
to watch movies rated for 13 and older«End()»
.
Another one: suppose you want to write a sentence which has either the child’s name or, if the child is not yet a teenager, the nick-name, but only if the child in fact has a nickname. This time ‘and’ is used inside the condition:
My child
«If(Age < 13 and NickName != ‘’)»«NickName»«Else()»«ChildName»«End()»
is a genius.
Try these examples out: just select and copy this article in the browser, paste into Word and click the XpressDox “Run This Template” button.