Can anyone please explain the enhanced for loop syntax to me? 😔 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone please explain the enhanced for loop syntax to me? 😔

26th Jun 2017, 1:33 PM
Raktim Mukherjee
Raktim Mukherjee - avatar
3 Answers
+ 4
See it like this: For(Type variable_Name : Array){ //You can use variable_Name } Type is like Integers, Strings, Characters, etc. So in simple words: For each Element (alias is variable_Name) in Array do {this and that} I hope this makes sense https://code.sololearn.com/c91ddKzNrFlb/?ref=app
26th Jun 2017, 6:38 PM
Limitless
Limitless - avatar
+ 1
An axample : for (int x = 0; , x <10; , x++){ //do stuf } int x = 0 >>> we initialse the iterator (x) x<10 >>> we will repeate this loop until this statement returns false x++ >>> if we increment or decrement the iterator (x) NOTE :if the ";" MUST be after the first and second argument off the for loop
26th Jun 2017, 6:43 PM
wazoowazoo
+ 1
thank u limitless i understood it 😄 and i would also thank wazoowazoo because he took urge to help me 😅 but see my question again wazoo 🤗 thank u
26th Jun 2017, 6:47 PM
Raktim Mukherjee
Raktim Mukherjee - avatar