#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Adding an and into a list

edited November 2015
Good evening. Having recovered from my animal conundrum I have, Hopefully, a simple one. I am trying to get a list of items that does not repeat but that has an and in . I want to end up with something like you see cows, horses and sheep.
Is this possible and if so how the heck do I do it.

• Ah, here's one I can sink my teeth into! Near as I could tell, it's not all that simple; at least, there's no elegant way to do it. That said, you can use this decidedly un-elegant trick:
```Table: Animals
1- &#91;@Andify with beasts, 1, @, and&#93;
2- &#91;@Andify with beasts, 2, @, and&#93;
3- &#91;@Andify with beasts, 3, @, and&#93;
4- &#91;@Andify with beasts, 3, @, or&#93;
5- &#91;@Andify with beasts, 3, !, and, Y&#93;
6- &#91;@Andify with beasts, 3&#93;

Table: beasts
a bear
a big cat
a wolf
a pack of {1d6+2} wolves

table: Andify
set: destTable={\$1}
set: numRolls={\$2}
set: rollType={\$3}
set: andOr={\$4}
set: oxfordComma=&#91;{\$5} &gt;&gt; lower&#93;
&#91;when&#93;{oxfordComma}=y&#91;do&#93;{oxfordComma==','}&#91;else&#93;{oxfordComma==''}&#91;end&#93;&
&#91;when not&#93;{rollType}&#91;do&#93;{rollType=='@'}&;#91;end&#93;&
&#91;when not&#93;{andOr}&#91;do&#93;{andOr=='and'}&#91;end&#93;&
&#91;when&#93;{numRolls}=1&#91;do&#93;&#91;@RollOnTable&;#93;&#91;end&#93;&
&#91;when&#93;{numRolls}=2&#91;do&#93;&#91;@RollOnTable&;#93; {andOr} &#91;@RollOnTable&;#93;&#91;end&#93;&
&#91;when&#93;{numRolls}&gt;2&#91;do&#93;{numRolls=={{numRolls}-1}}&#91;@{numRolls} RollOnTable &gt;&gt; implode&#93;{oxfordComma} {andOr} &#91;@RollOnTable&;#93;&#91;end&#93;&
{rollType==''}{andOr==''}{oxfordComma==''}

table: RollOnTable
&#91;when&#93;{rollType}=@&;#91;do&#93;&#91;@{destTable}&;#93;&#91;else&#93;&#91;!{destTable}&#93;&#91;end&#93;
```
(the "1-" in Animals is just so that you can see which call to Andify is being performed)

The table "Andify" takes the following parameters:
• destination table
• number of rolls
• roll type ("@ or !", defaults to "@)
• and/or (for the word that separates the last item of the group; expects "and" or "or", defaults to "and")
• oxfordComma (if this is "Y" or "y", groups of three or more will have a comma before the "and", defaults to "no oxford comma")

Hope this helps!
• Whoa...that's huge really appreciate you taking the time...when I say huge in my mind it was a couple of brackets a colon and a squiggle