Answer the question
In order to leave comments, you need to log in
How to get around restrictions when using recursion in less*?
Just tell me if it's possible to get around the recursion restrictions. If so, how?
*On codepen:
@num: 1;
.mixin() when (@num =< 100) {
#square-@{num} {
animation-delay: @num;
}
@num: @num + 1;
}
.mixin();
Answer the question
In order to leave comments, you need to log in
https://codepen.io/paulradzkov/pen/vjEdbM
Instead of recursively defining a variable, we call the mixin recursively:
@num: 100;
.mixin(@num) when (@num > 0) {
.mixin(@num - 1);
[email protected]{num} {
animation-delay: @num;
}
}
.mixin(@num);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question