Answer the question
In order to leave comments, you need to log in
Why is the nested loop iteration skipped?
In continuation of the question .
Guys for the first time in general I write something similar.
The general task is to build a query string like this:
I generate these strings, specifying different parameters, for example
- the first parameter is the number of data elements (which always starts from 01 and up to 999)
- the second parameter is a range of numbers, for example from 1 to 5
By a simple condition in the loop, with the first parameter, I easily generate strings:
text data01 text 1 2 3 4 5
text data01
text data02
text data03
...
text data10
text data11
text data12
1 2 3 4 5
2 3 4 5 1
3 4 5 1 2
4 5 1 2 3
5 1 2 3 4
int start = 1, last = 5;
int[] arr = Enumerable.Range(start, last - start + 1).ToArray();
int count = arr.Count();
int n = 5; // количество data
for (int j = 1; j < n; j++)
{
textBox.AppendText("text data0" + j);
for (int i = 0; i < count; i++) {
textBox.AppendText($"{ arr[(i + j) % count]}");
}
}
text data00 1 2 3 4 5
text data01 2 3 4 5 1
text data02 3 4 5 1 2
text data03 4 5 1 2 3
text data04 5 1 2 3 4
text data05 1 2 3 4 5
text data01 1 2 3 4 5
text data02 2 3 4 5 1
text data03 3 4 5 1 2
text data04 4 5 1 2 3
text data05 5 1 2 3 4
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question