While loli function

I am trying to write a loli code, which will complete some steps for each element in a LIST.
The problem is that these steps will need to use values from few LISTs.
As example:

LIST A = [a, b, c, d, e]
LIST B = [1, 2, 3, 4, 5]
LIST C = [x, z, y, n, m]

Now while I am completing some steps for each element in LIST A (let’ say element with INDEX 2 => “c”) I will need to get element from LIST B and LIST C witht he same INDEX (index 2 => “3” from LIST B, “y” from LIST C).

How can I do that?

I tried foreach, however I am not sure how can I get index number.

WHILE function looks totally different than it was in OB1 and I am not sure how to make it working.

Can you please give me some suggestions?

Old OB1 loli code:

UTILITY List "acid" Length -> VAR "LEN" 
SET VAR "int" "0"
WHILE "<int>" LessThan "<LEN>"

##working with all LIST elements using "<int>" index.


How can I make something similar in OB2?

thanks in advance

nevermind. I read that I can write c# code inside LoliCode xD This feature is awesome! <3

1 Like

In case anybody else is wondering, a simple for loop in C# will solve this easily.
Otherwise you can try this

// Get the length of the list and call it length
// Declare a constant integer called index with value 0

WHILE INTKEY @index LessThan @length
// use list1[index] or list2[index] wherever in your code
1 Like

LoliCode is just syntax sugar for C# so everything gets transpiled to C# at the end of the day, just go to the C# tab to see what code it produced and change it accordingly ^^

1 Like

Yes, correct!

Meanwhile I have another, probably stupid question.
I am trying to use UTILITY block (FILE APPEND LINES) and as a line I would like to append all elements of a LIST.
In OB1 this was enough:


In OB2 I am getting this output:


Is there any simple way to append all indexes or should I use some loop again?

You need to use File Append Lines block and the variable mode, so it will pass the actual list

Let me know if you have any more problem

1 Like