A potentially useful application for the <<*Set*>> commands is to compare or add (or subtract) the values of one or more existing !groupname! values.
E.g.,
<<*AskRepeat*!NumCats!How many cats?*>>
<<*AskRepeat*!NumDogs!How many dogs?*>>
<<*Set*!NumCritters!=!NumDogs!+!NumCats!>>
The resulting value of !NumCritters! can be used anywhere in the document. E.g.,
We have <<!numcats!>> cats and <<!numdogs!>> dogs. <<!NumCritters!>> pets may seem like a lot, but it's just right for me.
Actually, since you might not always have two or more of either kind of pet, you should add an Options block to account for plural vs. singular,and add the 's' as appropriate. You may recall from an earlier lesson that while recording a raw value associated with a Repeat Pathagoras also assigns one of three different 'attributes' to that groupname, 'Zero', 'One' and '2+'. This is called the re: the 0/1/2+ rule. Use this to assign the plural 's' after 'cat' and 'dog' when appropriate.
We have <<!numcats!>> cat<<*Options*!numcats!*s//s>> and <<!numdogs!>> dog<<*Options*!numdogs!*s//s>>. <<!NumCritters!>> pets may seem like a lot, but it's just right for me.