In my latest App I have 2 arrays and I would like to pick an index of the first array, which contains similar words like any index of the first array.
The goal is to pick the index of the first array, that contains words which the user has put in his "favourites" (second array).
1. Dog Flower Cat
2. The cool cat
1. ??? ??? ???
2. Flower Cat Smiley
In this case, the first index of the first array contains two matching words with the second index of the second array so the program should pick the first index of the second array.
Hopefully this explains my problem a little better .
I just tried to do it with many loops but I actually lost the overview :/ .
Does anyone know of an easy way to do it?
Any help is appreciated!
It would be easiest to have 2 dimensional arrays, where your x axis is each list of words and your y axis is the words themselves. If this comes from a text box from the user's input, you will have to parse these using the tokencount and tokenat expressions. I have put together an example app for you, which works according to your explanation however -- https://mega.nz/#!CtNDFDjb!FyfDEm50qRNCSg-dyf1_OqFi3cg4SNBlYIFoiymg4yg
Develop games in your browser. Powerful, performant & highly capable.
Thanks paladin it works perfectly!
Depending on your data structure, the dictionary object may be worth looking in to as well. You would have an instance of a dictionary for each set of words, and you would be able to use the "For Each Key" and "Has key" conditions to check for matches.
I'll be looking into that aswell! I haven't done anything with the dictionary object yet..