+ 5
For loops
please, Is it possible to declare two variables in a for loop?........ e.g: for(int y = 3, d =5; y <= 10; d++)
22 Respuestas
+ 60
yes you can declare two variables with for loop like this
for(int i=0, j=5; i < 5; i++, j--)
but take care condition part is not separated by seperator (,)
for(int i=0, j=5; i < 5, j > 5; i++, j--)
+ 21
Yes, it is possible to instantiate two variables of the same type in the for loop declaration.
But this example is an infinite loop, because you test the variable that isn't incremented.
Just try it out at the code playground.
+ 5
yes,it is possible
+ 5
Var x=0
For(;×<=20 x+=_)
Document.write(×)
+ 4
Declaring multiple variables in a single declaration could cause confusion about the types of variables and their initial values. In particular, do not declare any of the following in a single declaration:
- Variables of different types
- A mixture of initialized and uninitialized variables
In general, you should declare each variable on its own line with an explanatory comment regarding its role. While not required for conformance with this guideline, this practice is also recommended in the Code Conventions for the Java Programming Language, §6.1, “Number Per Line” [Conventions 2009].
+ 3
yes
+ 3
yes excatly
+ 3
what dose means sum =0
+ 3
Can someone help me to fill this_blank
+ 2
yes you can and you can do another thing for example
for(int i = 0 , j = n ; i < n ; --j , ++i)
{
}
+ 2
Yes it is possible like we declared variables by separating them like int a=3, b=4;
+ 1
yea you can
+ 1
Of course
+ 1
yes it is possible.
+ 1
👌
+ 1
It is possible. It can be done with more than 2 variables. You could use 10 variables if you wanted to.
0
yes you can.
0
Yes it is possible
0
Как мне это решить!!!!!??????? >:(
0
Can someone plz explain this code to me in brief ??