for-loop tag

11 questions


1 answers
122 views
0
How to break multiple repetitive statements at the same time

From the source code below,Is there a way to get out of the overlapped repeat door at once using break?int main(){ for(int i=0; i<A; i++){ //... for (int j=0 ; j<B; j++) { //... for (int k=0...


1 answers
103 views
0
How to access std::map to auto?

std::vector<int> numbers = { 1, 2, 3, 4, 5, 6, 7 };for ( auto xyz : numbers ){ std::cout << xyz << std::endl;}In C++0x, vector for for if you turn the xyz door like this, int type w...

2 years ago

1 answers
110 views
0
To remove elements with all null values from an ArrayList or String array

I'd like to remove all elements that have null values from the ArrayList or String array in JavaFor me,for (Tourist t : tourists) { if (t != null) { t.setId(idForm); } }I tried turning around the ...


1 answers
96 views
0
For-each syntax in JavaScript

In Java, there's the same for syntax at the bottom. String[] myStringArray = {Hello,World};for(String s : myStringArray){ //Do something}Is this not available in JavaScript?

2 years ago

1 answers
83 views
0
There are no conditional statements in the for statement in this code. Why?

I'm changing the C++ algorithm to C#, and I saw a for statement like this. for (u = b.size(), v = b.back(); u--; v = p[v]) b[u] = v;Errors appear on C# and work well on C++.I don't know what this repe...

2 years ago

1 answers
95 views
0
When is else used at the same level as the for / while repetition statement?

for i in range(10): print(i) if i == 9: print(Too big - I'm giving up!) break;else: print(Completed successfully)I don't know why you use else when you have a code like this.At first, I thought the ...


1 answers
146 views
0
Why do you use > or < instead of != when increasing by 1 in the for statement?

Why do you use > or < instead of != when increasing by 1 in the for statement?In the chords that other people made,I've rarely seen a for statement that increases by 1.Is there any special reaso...

2 years ago

2 answers
87 views
0
I want to know the difference between ++i and i++

What is the difference between the potential increase (++i) and the posterior increase (i++) in C?Which of the two should I use when I go around the for door?


1 answers
133 views
0
To check null in a repeat statement

Is there a good way to check if the list is null when going around for loop in Java?if (someList != null) { for (Object object : someList) { // // do whatever }}//I if (someList == null) { return; //...

2 years ago

1 answers
82 views
0
How do I turn std::map to repeat?

std::map< std::string, std::map<std::string, std::string> >My brother m[name1][value1] = data1;m[name1][value2] = data2;m[name2][value1] = data1;m[name2][value2] = data2;m[name3][value1] =...

- 1 - »

© 2024 OneMinuteCode. All rights reserved.