I updated the original code and I have another question here. what I tried is to remove the elements which is both existed in arr_a and arr_b. But I hit below error… not sure how to fix it.
Error-[IUCV] Invalid use of ‘const’
foreach (arr_a[i]) begin
foreach(arr_b[j]) begin
if(arr_a[i] != arr_b[j]) begin
...
end
else begin
arr_a.delete(i);
arr_b.delete(j);
i--;
break;
end
end
end
I tried lots of times but it happened to me that it’s different behavior sometimes today. But it’s strange to me that I can’t reproduce it…anyway, I will use the first code in my proj. Thank you.
It would really help to show the exact error message pointing to the exact line having the problem. There is no ‘const’ anywhere in the code you have shown. Also, show us the declaration of arr_a and arr_b. I’m assuming they are queues. You cannot modify the size of an array while you are iterating its elements with a foreach loop. The inner foreach is OK because you are breaking out of it, but not the outer.