nategrigg.com

Multi Variable For Loops

Thursday, 23 September, 2021

Today I learned that Java can have multiple variables in a for loop:

for (int i = 0, j = 3; i < 10 && j < 60; i += 1, j += 2) {
//...
}

Who knew?

By the way: I don’t intend to use this feature (mostly).