c# - Multiple statements in for -


i have code

for(int l = 1 ; l <= c ; l++, sleep(500*min(l, 8))) //... <= 4000 msec   {       ....   } 

would equivalent this?

for(int l = 1 ; l <= c ; l++) //... <= 4000 msec   {       sleep(500*min(l, 8))          ....   } 

i want rewrite original code in c#. second approach same way take in c#?

no not equivalent. stopping condition of for loop executed after code in following { } block.

so equivalence

for(int l = 1; l <= c; ) {     /*loop body*/     l++, sleep(500 * min(l, 8)); } 

the expression separator operator (,) could replaced statement terminator ;. both sequencing points, sleep receives incremented value of l.


Comments