0
Answer

each array element as an individual number?

Ad

Ad

20y
1.7k
1
Hi, I have a simple array like this: public static int[] numbers = new int[] { 27, 13, 44, 5, }; I have just shortened it but it is a lot bigger. What I want to do is if a number is picked and it exists in the array of numbers by doing something like this: foreach ( int equal in kills ) { if ( chosen == equal ) { } } What I am having trouble is, if the number picked is, for example 5, as it's the 4th element, add the number 3 to a different var. Again, if the number picked is 27 then add nothing. Is this something that can be done? Would I be right to do something like numbers[4] = 4? Would that overwrite what 5 is and make it 4? Thanks for any help
Next Recommended Forum