0
I don't understand why my code exits my for loop after assigning x a value of 0 can someone please explain.
I don't get why it enters the loop assigns x then exists the loop. I am writing on pc and asking here using examples of what Im working with on pc. https://code.sololearn.com/cChESHnuQk2o/?ref=app I'm working on pc only asking here so this is occurring on pc.
2 Respostas
0
https://www.dotnetperls.com/array
A array has a fixed size.
So you have to define the number of elements
string[] arr4 = new string[3];
arr4[0] = "one";
arr4[1] = "two";
arr4[2] = "three";
or initialized the elements upon definition.
string[] arr1 = new string[] { "one", "two", "three" };
Can you use a list ?
https://www.dotnetperls.com/list
List<int> list = new List<int>();
0
A simple C# List for loop example..
List<object> list = new List<object>();
for (int i = 0; i < list.Count; i++)
{
SomeMethodThatDoesSomethingWithAnObject(list[i]);
}
http://csharp.net-informations.com/collection/list.htm