0
Can we write for loop in this way" for(intialization: expression)" (in java)
4 odpowiedzi
+ 3
It is an enhanced for loop.
int array:
for(int i: arr){
//some code
}
String array:
for(String s: arr){
//some code
}
0
Which language are you using?
In C# you can do it like this:
for(initialization; expression;)
{
statements;
increment; (optional)
}
0
Depends on the language. In most languages you can skip some parts of the for loop, for example: for(int i=0;i<10;)
Here you skip the increment part, also you can skip initialization for(;i<0;i++)