0

Ballpark Orders - Split method [Solved]

Can anybody tell me why my index keeps going 0, 1, 2, ... no matter which combination I enter? Does it have anything to do with the Split method I used? The string of orders is entered with spaces only. (Also, if anybody can tell me how to do this with one single (multidim?) array, I'd be grateful.) https://code.sololearn.com/cv48Ea0K7Y9g/?ref=app

16th Jul 2022, 9:56 AM
Hannelore Van de Calseyde
Hannelore Van de Calseyde - avatar
3 odpowiedzi
+ 2
You can link your code like this: Go to Code section, click +, select the programming language, insert your code, save. Come back to this thread, click +, Insert Code, sort for My Code Bits, select your code. This way others can test your code and it is much more readable.
16th Jul 2022, 10:03 AM
Lisa
Lisa - avatar
+ 2
When you try to get the index in foods, you actually try to get the index in words. I think what you want to do is: Array.IndexOf(foods, word)
16th Jul 2022, 10:10 AM
Lisa
Lisa - avatar
+ 1
Thank you Lisa. I've added the code :) Also, how on earth did I not notice I was getting an index from the wrong array? Thank you!
16th Jul 2022, 10:12 AM
Hannelore Van de Calseyde
Hannelore Van de Calseyde - avatar