how to write a WHILE loop in Rythm
-
21-06-2021 - |
Question
I try to write a While loop in Rythm within HTML tags but I can't
something like this code:
@{
int i = 0;
while( i< 5){
i++;
}
<h2>hello</h2>
@{
}
}
Solution
At the moment Rythm does not support while
loop. Use for
loop instead for your case:
@for(int i = 0; i < 5; ++i) {
<h2>hello</h2>
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow