Is it possible in Stylus to set for a for loop together and a range of values, and individual values?

for item in range(2, 7) 14 33 li:nth-child({item}) label color red 

or

 for item in 2..7 14 33 li:nth-child({item}) label color red 

This code does not work. Works, only OR range, or individual values.

  • Probably it is impossible, what prevents to prescribe for item in 2 3 4 5 6 7 14 33 ? - greybutton
  • @greybutton write a lot of numbers, looks bad. Better on CSS:: :nth-child(n+1):nth-child(-n+10):not(:nth-child(6)): for example - CodeGust

1 answer 1

Reply received at https://stackoverflow.com/a/42610706/873481

I translate and quote the code:

Unfortunately, there is nothing in Stylus like concat from the standard library, just push, but you can easily write this:

 concat() ret = () for item in arguments push(ret, item) ret body for i in concat(range(0, 5), 10, 55) test: i