Dictionary comparison not returning correct output

Certified Lead Developer

I am facing a weird issue when comparing two arrays of dictionary type. As in the code attached, I have two arrays of dictionary from which I am converting one of them to be similar to other one using foreach loop. I am pretty much sure that output after conversion is same as "array1" in code snippet.

But, still their comparison returns {false, false, false} as output of it. And, when I run the commented comparison below, it returns {true, true, true}.

Why direct comparison is returning correct output but not the output from foreach besides the fact that formats and outputs are exactly same.

a!localVariables(
  local!array1: {
    { value1: "abc", value2: "cde" },
    { value1: "fty", value2: "yui" },
    { value1: "uiu", value2: "dft" }
  },
  local!array2: {
    { value1: "abc", value2: "cde", value3: "gdh" },
    { value1: "fty", value2: "yui", value3: "hyu" },
    { value1: "uiu", value2: "dft", value3: "kol" }
  },
  local!convertedArray2: a!forEach(
    items: local!array2,
    expression: {
      value1: fv!item.value1,
      value2: fv!item.value2
    }
  ),
  local!convertedArray2 = local!array1
  /*local!array1 = local!array1*/
)

  Discussion posts and replies are publicly visible