code coach - ball park [easy] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

code coach - ball park [easy]

what's the problem with my code.. I cant get it right https://code.sololearn.com/cqmO7zKh84jZ/?ref=app

4th Jan 2021, 3:27 AM
MistaKoruto
MistaKoruto - avatar
2 Answers
+ 4
Try changing to an if-else if-else or a swtich-case-default instead. You're not providing the price of a coke if the food item doesn't match (else or default). No need to check the remaining cases if you find a match (else if).
4th Jan 2021, 3:47 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
thanks, I didn't notice about coke if the item doesn't match.
4th Jan 2021, 11:03 AM
MistaKoruto
MistaKoruto - avatar