BallPark PLEASE help!!! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

BallPark PLEASE help!!!

Please help me learn how to work with an array of strings in switch. what am i do wrong ? https://code.sololearn.com/cV3TGr0aeld2/?ref=app

26th Feb 2023, 10:57 AM
Михаил Холодный
Михаил Холодный - avatar
1 Answer
+ 3
There are a few issues with the code you provided: 1) The switch statement is trying to use the entire orders array as the input, but it should be using the individual elements of the array. You can do this by changing the switch statement to switch(orders[i]). 2) The for loop is only looping through the first 4 elements of the array, which may not be all the orders. You can change the loop to for(int i = 0; i < orders.Length; i++) to loop through all the elements of the array.
26th Feb 2023, 11:32 AM
Last
Last - avatar