Compare and Remove All From List

Hello
I need help

I have a List1 and List2
I need read all lines and remove lines of list2 contained in list 1
I make a code, but I received a correct output, but actually that’s not what happens when you save the final list.

Here is my code

BLOCK:FileReadLines
LABEL:LISTA TO REMOVE EXIST
  path = "teste.txt"
  => VAR @Listaremove
ENDBLOCK

BLOCK:FileReadLines
LABEL:Lista Final
  path = "teste2.txt"
  => VAR @ListaFinal
ENDBLOCK

BLOCK:RemoveAllFromList
  list = @Listaremove
  comparison = Exists
  term = @ListaFinal
ENDBLOCK

BLOCK:FileAppendLines
  path = "result.txt"
  lines = @Listaremove
ENDBLOCK

image
image

on the console, everything works fine, but in practice it doesn’t.

My List teste1.txt contains

joao
silva
larence
kraken
squid

and My List teste2.txt contains

joao
silva
larence
kraken
squid
mjhsui
diferent

Thank you, wait a reply and help!

That block doesn’t work like that. It doesn’t remove some elements of list 2 from list 1, it just removes all elements of a list that match a condition.

For example:
list = [hello, hi, bonjour]

Remove all from list → where the value contains “h”
Means it will remove [hello, hi] and you will just end up with [bonjour].

See this example to achieve what you are trying to do instead. You could do the same with a FOREACH loop in LoliCode but it would be more verbose.

BLOCK:ConstantList
  value = ["one", "two", "three", "four"]
  => VAR @list1
ENDBLOCK

BLOCK:ConstantList
  value = ["two", "four"]
  => VAR @list2
ENDBLOCK

List<string> difference = list1.Where(x => !list2.Contains(x)).ToList();

LOG difference