+ 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)
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.
+ 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
+ 4
U can make the range function for the range purpose,like i have created this one:
https://code.sololearn.com/c3e54MZ54m6c/?ref=app