Error : ) expected

hello,

I dont see what’s the problem here :

What did you write to generate the while statement? This would be the correct way

WHILE STRINGKEY @IBAN EqualTo ""

maybe you missed to write STRINGKEY or something?

I wrote

WHILE IBAN EqualTo “”

I did not know I had to precise each time the type of the variable in a loop, thanks

Yes any time you are using keys you have to specify the type otherwise the transpiler might not know exactly which types to expect, for example there is the same keyword (Contains) both in string keys and in list keys but they have 2 different uses (one to check if a string contains a substring, the other to check if a list has an element like a given string). So it needs some help to identify what you are doing, since inferring it automatically would have required a lot of work on the coding side for me ^^

If you don’t specify anything it will just not treat it as a key and write it as-is inside the C# code, so if you want you can type

WHILE IBAN == ""

and it should work since the stuff after the WHILE keyword is valid C# code and doesn’t need any additional transpiling.

Thanks, I don’t know C# and not used with programming, so I will keep using lolicode syntax

CLECODE is a list of string, what will be the key syntax ? I can’t find anything in the documentation

LISTKEY. You can easily check how the keys are written in LoliCode by adding the same keys to a Keycheck block, then go to the LoliCode section to see exactly how they are written. The syntax is the exact same for the IF and WHILE statements. I agree there is a lack of documentation on this, so please feel free to open an issue on github and I will add more docs :wink: I’m on vacation right now so it will happen when I’m back home most likely

Thanks

Unfortunately, I still have an error while I did all the changes !

It’s like FOREACH is not recognized !

I created a new config with

BLOCK:ConstantList

  value = ["aaa", "bbb", "ccc"]

  => VAR @list

ENDBLOCK

FOREACH STRINGKEY @elem IN LISTKEY @list

LOG STRINGKEY @elem

END

And I got this C# code :

// BLOCK: Constant List

data.ExecutingBlock("Constant List");

List<string> list = ConstantList(data, new List<string>{"aaa", "bbb", "ccc"});

// BLOCK: LoliCode

data.ExecutingBlock("LoliCode");

FOREACH STRINGKEY @elem  IN  LISTKEY  @list  data . Logger . Log ( STRINGKEY  @elem  )

; }

I followed the syntax in the doc : FOREACH IN END

If I delete all @ and KEY, foreach is now recognized in c# code …

FOREACH does not need the key type as it’s not taking a key. Only IF and WHILE take the key type. Remove STRINGKEY and LISTKEY after FOREACH and it should work just fine. Otherwise try to remove the @ symbol and put it like this

FOREACH elem IN CLEDOC

Please refer to the documentation you find inside OB2 itself, it comes with examples.