I was wondering how to express a certain type of for loop in Java.
In Python I would use:
for x in lst1:
return 10
How would I do this in Java?
I know for the range for-loops, I use
for(int i=0; i<100; j++) {
return "asdf"
}
I just want to know how to do the other type of loop
int[] myints = {1, 2, 3, 4, 5};
for(int i : myints) {
System.out.println(i);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With