+ 3

for loop

Usually, for loops look something like this: for(x=0;x<10;x++) But wht do some for loops look like this? for(int y:x)

2nd May 2019, 4:13 PM
Pikachu
Pikachu - avatar
3 odpowiedzi
+ 6
That's a C++ simplification of looping similar to 'for each' in other languages. Int y declares the type of each item, x in this case would be a collection like vector. Then you can just do whatever you want to do with each y.
2nd May 2019, 4:23 PM
HonFu
HonFu - avatar
+ 4
Aki Ko HonFu ~ swim ~ See thiss🤩🤩🤩 i have derived foreach loop in c++ using #define preprocessor directive https://code.sololearn.com/cl5dRAoh6kaa/?ref=app
6th May 2019, 3:03 PM
Mohan
Mohan - avatar
+ 4
U can make the range function for the range purpose,like i have created this one: https://code.sololearn.com/c3e54MZ54m6c/?ref=app
12th Aug 2019, 6:39 PM
Mohan
Mohan - avatar