Top "For-loop" questions

A for loop is a control structure used by many programming languages to iterate over a range.

For each operator in Thymeleaf

I can not find syntax for building simple for-each-loop in Thymeleaf template. I'm not satisfied with just th:each="" attribute, …

spring spring-mvc for-loop foreach thymeleaf
How to get the current index in for each Kotlin

How to get the index in a for each loop? I want to print numbers for every second iteration For …

android for-loop kotlin
Change values while iterating

Let's suppose I have these types: type Attribute struct { Key, Val string } type Node struct { Attr []Attribute } and that I …

arrays for-loop go
Using Objects in For Of Loops

Why isn't is possible to use objects in for of loops? Or is this a browser bug? This code doesn't …

javascript for-loop ecmascript-6 iterable
Finding factors of a given integer

I have something like this down: int f = 120; for(int ff = 1; ff <= f; ff++){ while (f % ff != 0){ } Is there …

java for-loop integer while-loop factors
C: for loop int initial declaration

Can someone elaborate on the following gcc error? $ gcc -o Ctutorial/temptable.out temptable.c temptable.c: In function ‘main’: …

c for-loop gcc syntax-error
Python - Way to restart a for loop, similar to "continue" for while loops?

Basically, I need a way to return control to the beginning of a for loop and actually restart the entire …

python loops for-loop continue
Java 8: Parallel FOR loop

I have heard Java 8 provides a lot of utilities regarding concurrent computing. Therefore I am wondering what is the simplest …

java for-loop concurrency java.util.concurrent concurrent-programming
addEventListener using for loop and passing values

I'm trying to add event listener to multiple objects using a for loop, but end up with all listeners targeting …

javascript for-loop addeventlistener
Why use iterators instead of array indices?

Take the following two lines of code: for (int i = 0; i < some_vector.size(); i++) { //do stuff } And this: …

c++ for-loop stl iterator containers