navinsubramani / LabVIEW-Script-Language

Developing a platform to develop scripts, compile and execute it in the LabVIEW development or run time environment
MIT License
8 stars 2 forks source link

Loops & Structures functions #13

Closed navinsubramani closed 2 years ago

navinsubramani commented 5 years ago
pranay001 commented 5 years ago

while loop is implemented as expected, with syntax while($continue?$). where continue? is a boolean type which helps in making a decision whether to execute the while loop or now.

But what can be the syntax for For Loop, take the below different types of for loops.

Also, the execution of for loop has to be as shown below.1->2->3

image

but in our case, our execution will be as denoted by arrow.

Please give your suggestions to proceed further.

navinsubramani commented 5 years ago

For loop has a lot of cases but in general, the structure is,

for(Initialize Variables; Condition Statement;Update Variables) -> One Indent

It is easier to handle the 'Condition statement' using functions and 'indent' like any other structure.

The challenge here is that the 'Init Variables' and 'Update Variables' part could be a bit flexible and can have many functions or statements with comma-separated values.

Though it is easier to implement the 'for(i=1; any condition;i=i+1) - We can start with it

But somehow I feel if you add the function for comma separator as $anything$,$anything$ - there is a chance that the framework would intelligently pick the $anything$ as a function and do the needful. Please try this and let me know - I guess we should be able to implement this without any issues given the tool is CRAZY in its capabilities :)