3
I want to basically do this
for (j = parametro, int k=0; j < parametro + 3, k<3; j++, k++) {
previsoes[i] += valores[j] * pesos[k] ;
}
3
I want to basically do this
for (j = parametro, int k=0; j < parametro + 3, k<3; j++, k++) {
previsoes[i] += valores[j] * pesos[k] ;
}
10
Can.
Note that after the first statement you do not need to specify the type. The increment is correct. I took advantage and added an example of how to put "two conditions".
Thus:
class Main {
public static void main(String[] args) {
for (int i = 0, k = 0; i < 10 && k < 3; i++, k++) {
System.out.println(i);
System.out.println(k);
}
}
}
Good! + 1! Just one detail: it’s not that it doesn’t accurate specify the type of the second variable. It can’t specify the type of the second variable (even if it is the same type as the first). It is as if you declare two attributes of the class separated with comma. This only works if the attributes are of the same type.
@Igorventurelli Yes, it’s because you can only add one statement one-line. I’ll make this clearer. I appreciate the feedback
Browser other questions tagged java syntax for
You are not signed in. Login or sign up in order to post.
You ruined my little joke, brother =/
– Jéf Bueno
Anyway, I hope my answer has helped you
– Jéf Bueno
It helped a lot, thank you!
– Wesley