What is the practical value of initiating more than one variable inside the first statement of a for loop? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the practical value of initiating more than one variable inside the first statement of a for loop?

I believe it makes the loop difficult to comprehend later on.

29th Jan 2016, 1:20 PM
Erlin Goce
Erlin Goce - avatar
3 Answers
0
use colon to initiate more then one value in single line in a loop e.g int a,b,c; then after the last variable or value end it with semicolon
13th Jun 2016, 10:36 AM
Iman Ali
Iman Ali - avatar
0
true, most of the time multiple variable values are set outside the for loop by omitting the first statement ,so it has less practical value
24th Jun 2016, 11:07 AM
Karadi Sathyajith
Karadi Sathyajith - avatar
0
It is there for that special cases just like 'x = 3' rerurning 3 where it was called. It's part of the language and standard, and it don't hurt anybody just being here. Problem of comprehension is usually matters for junior programmers that don't have experience and haven't seen some clever or elegant ways to do stuff.
1st Jul 2016, 9:23 PM
Azriel Gridfen
Azriel Gridfen - avatar