Check this result make sure it fits all the boundary cases you where expecting:
T = Ki = 0; i = 0;
While[i < 5,
Print["i:", i]; i++;
m = 1; n = 0.1; tmin = 1;
While[T < tmin,
Ki = Ki + m*n;
T = Ki;
tmin = T
];
Print["T:", T]
]
i:0
T:0.1
i:1
T:0.2
i:2
T:0.3
i:3
T:0.4
i:4
T:0.5
Equivalent For loop. Notice that the For[init, test, inc, body] loop evaluates the arguments out of order, like this: init, test, body, inc.
For[T = Ki = 0; i = 0, i < 5, i++,
Print["i:", i];
For[m = 1; n = 0.1; tmin = 1, T < tmin, tmin = T,
Ki = Ki + m*n; T = Ki
];
Print["T:", T]
]
i:0
T:0.1
i:1
T:0.2
i:2
T:0.3
i:3
T:0.4
i:4
T:0.5