0

Its saying basically that they are all not equal to b

static void Main(string[] args) { string itemsInBoxs; string whatYouWant; itemsInBoxs = Console.ReadLine(); whatYouWant = Console.ReadLine(); Console.Write(HowLongItGonnaTake(itemsInBoxs ,whatYouWant) * 5); } static int HowLongItGonnaTake(string a, string b) { int count = 1; foreach (string word in a.Split(",")) { if(b != word) { count ++; } } return count; }

19th Jun 2022, 11:26 PM
Jakub Quinn
Jakub Quinn - avatar
3 Antworten
0
I was able to do an else then break the loop and it worked
20th Jun 2022, 3:31 AM
Jakub Quinn
Jakub Quinn - avatar
+ 1
Jakub Quinn You cannot compare String like that. a != b //wrong !a.Equals(b) //right
20th Jun 2022, 3:28 AM
A͢J
A͢J - avatar
0
This for the safety deposit box challenge on meduim
19th Jun 2022, 11:29 PM
Jakub Quinn
Jakub Quinn - avatar