Even in C, for loops allow only one variable declaration statement as the initializer (but you can declare multiple variables in that statement).
Syntactically, X10 is more powerful than C here, because in C you can only declare variables of the same type, whereas the only thing they have to share in X10 is their mutability. However, the following fails:
for (var i: Int = 1, j: Double = 10.0; i < 10; i++, j--) {
Console.OUT.println(i/j);
}
XTENLANG_1173.x10:3: Local variable declarations in a for loop initializer must all be the same type, in this case x10.lang.Int, not x10.lang.Double.
1 error.
Exception in thread "main" polyglot.util.InternalCompilerError: XTENLANG_1173.x10:3,26-41: Local variable declarations in a for loop initializer must all be the same type, in this case x10.lang.Int, not x10.lang.Double.
at polyglot.ast.For_c.typeCheck(For_c.java:133)
at polyglot.ast.JL_c.typeCheck(JL_c.java:180)
at polyglot.visit.TypeChecker.leaveCall(TypeChecker.java:106)
at x10.visit.X10TypeChecker.leaveCall(X10TypeChecker.java:101)
(no reason for it to fail except some misguided notion of C/Java compatibility).
Two variables of different mutability indeed cannot be syntactically declared in the for loop header in X10.
More importantly, can you have multiple for update statements, e.g.,
for (...; ...; i++, j--)?
for (...; ...; i++, j--)