Duplicates Within Random Array

Here is a simple function that will de-duplicate an array (of vectors in my case but the idea is the same for other types).

  • We have an input variable RawArray to plug our original array into.
  • We have a local variable WorkArray that starts empty and then holds our data while the function operates.
  • Finally we have an output variable CleanedArray which we can use out in the rest of our code.

We clear WorkArray straight away, in case data got left in there somehow.

We use a ForEachLoop to iterate through each item in RawArray (our input variable) and IF that item is not yet in WorkArray we Add that item into WorkArray

After we are done iterating, we Return Node, making sure to plug WorkArray into the CleanedArray slot on the Return Node.