0
Is there a way to compare the current value with previous value using a for each loop?
I'm able to do it using a for loop but I want to us a for each loop because I don't know the index length of the elements I'm looping. When I use a for loop, I use the i to refer to the elements of my array. Like: Current item: myArray[i] Next item: myArray[i+1] Previous item: myArray[i-1] I know we have clever brains here so someone would know the answer
12 Réponses
+ 1
thanks for your input, I'm learning new stuff everyday
+ 1
I inserted commas on each iteration, I hope I did right.
https://code.sololearn.com/cC4sYmFxAIQ3/?ref=app
0
how gordie? Is there a source code for that?
0
thanks
0
ok, Is it possible to add a comma from each iteration on a for each loop gordie?
0
ok
0
how
0
how
0
How can I split the teams and be able to select them individually by using their index on the on the array?
Example:
Manchester United
Arsenal
Orlando Pirates
Manchester City...
Please see the below code!
https://code.sololearn.com/cC4sYmFxAIQ3/?ref=app
0
I'm getting an error when I run the code.
0
I tried the code below
https://code.sololearn.com/crfTQ9Vr6N1I/?ref=app
0
just posted!