Problem about "for" loop

_ROOT Version:6.26/04
_Platform:Win64
_Compiler:MSVC 19.31.31107.0


root [0] int len = 10;
root [1] int k1 = 0;
root [2] int x = 0;
root [3] for(k1 = 0;k1 < len;k1++)
root [4] {
root (cont'ed, cancel with .@) [5]    x++;
root (cont'ed, cancel with .@) [6]}
root [7] x
(int) 1

As the code runs, the value of x should be 10. Could you help me to find out where the problem occurs?

Try: for(k1 = 0;k1 < len;k1++) {

Thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.