Skip to content

WORDJOIN

Vera Chellgren edited this page Sep 18, 2021 · 1 revision

WORDJOIN is very helpful when you are starting with word lists that need some changes. Perhaps you have a list of prefixes and suffixes and you wish to join them together. Or maybe you wish to add the letter "s" to the end of all words in a list to create plurals.

Any time you wish to join words together from left to right, you can use the WORDJOIN command. With WORDJOIN, you can take as many lists and/or string literals as you like, and join them together from left to right.

Syntax

WORDJOIN newlistnames = listorstring1 + listorstring2 .... + listorstringN

where newlistnames is one or more list names which will contain the joined words; the typical use case is just one new list name. If multiple names are used, the results will be identical for each new list.

listorstring means either a list name, or a string literal surrounded by quotes. Nested quotes are allowed.

Examples

WORDJOIN animalsplural = animals + "s"

WORDJOIN colornoun = colors + " " + nouns

WORDJOIN maleformal = "Mr. " + lastnames

How it works with string literals

When you have string literals and no more than one list, WORDJOIN works intuitively. The string literal is added to every item in the list. Or if you have only string literals, then they are added together to form just one phrase. Either way, it's straightforward.

How it works when lists are of different lengths

Consider the situation where you have more than one list as WORDJOIN parameters, such as in the second example, WORDJOIN colornoun = colors + " " + nouns. We need to know what happens if the lists colors and nouns are of different lengths. YeetWords will always maximize variation, so whichever list is shorter will get repeated from the start when added to the longer list. For example, suppose the lists look like this:

colors

red

yellow

blue

nouns

chair

table

book

pen

phone

Then the command WORDJOIN colornoun = colors + " " + nouns will result in:

colornoun

red chair

yellow table

blue book

red pen

yellow phone

Related commands

ASSIGNLIST, UPCASE, LOWCASE, SUPCASE, SLOWCASE

Clone this wiki locally