If statment and iteration in designscript

This is my first try on designscript, so dont know if i have messed some python into the code.

I want to find out if degres >= 9 else it should be 9 and i want the output list to be the same structure as the imputlists so it looks like this
[[8], [9], [9], [9]]

hShadow;
start = hShadow + 1;
eaves;
degree = eaves-start;
 {
	result = [ ];
	for (i in List.Count(degree))
	{
		for (number in degree[i])
		{
			if (number >= 9)
			{
				result = 9;
			}
			else
			{
				result = number;
			}
		}
	}
	return = result;
};
c = start..result..1;

No need I can see here to do a loop. Try this:

numb >= 9 ? 9 : numb;

2 Likes

Ahh nice short code. Thanks
and for anyone else i found some documentation on it.
https://dynamobim.org/wp-content/links/DesignScriptGuide.pdf (6.3.Inline conditional expression)