How to loop on a LIST variable OB2

How to loop on a LIST variable using WHILE

THIS IS HOW IT’S DONE IN OB1

In what follows I will show how it is done in OB2, this is what they are passing their configurations from OB1 to OB2 for and they want to make a simple parallelism between the two, it should be noted that in OB2 the same can be done in more efficient ways, such as using FOREACH.

BLOCK:ConstantList
LABEL:LISTA_MUJERES
  value = ["JAZMIN", "ROSALIA", "SHAKIRA", "CLARA", "MACARENA", "ROSMERI", "JUANA", "MARIA"]
  => VAR @LISTA
ENDBLOCK

BLOCK:GetListLength
LABEL:LEN_LISTA_MUJERES
  list = @LISTA
  => VAR @LEN
ENDBLOCK


int INDEX = 0;

WHILE INTKEY @INDEX LessThan @LEN
CLOG Byzantine LISTA[INDEX]
INDEX = INDEX + 1;
END

4 Likes