Imperative While Loop Syntax


#1

I’m pushing forward into the fog of Loops (please don’t laugh too much). I’m attempting a simple loop that trims a single tier list of curves by a consistent start and end parameter. Here is the code block below:

Any help is welcome.
def curves.trim(curves)
{

trims = {};

c = curves;

i = 0;

cnt = List.Count©;

return = [Imperative]
{
while (i<cnt)
{

trim=Curve.ParameterTrim(c[0],0.25,0.75);
curves=List.DropItems(c,1);

trims[i] = trim;

i = i + 1;

}
return = trims;
}

};


#2

Hi Nick,

There’s a few minor things to note with your code:

 

 

 

Tho I’m not sure if “ParameterTrim” is a good representation of what imperative while loops should be used for. Good luck!


#3

Dimitar,

It worked! I know this wasn’t a great example of a while loop scenario, I just needed something simple to complete one. Thank you!

Nc