Closed WZYCX closed 1 year ago
Fixed! ' var inBasket = false for purchased in basket.currentBasket { if (item.name == purchased.name) { //if item exists in basket already +=1 else add new item inBasket = true break } } if inBasket==false { item.count+=1 basket.currentBasket.append(item) print(basket.currentBasket) basket.calculateCost() //updates basket total cost value print("Added item") } else { print("Already in Basket") } ' does not allow items to be added in twice
edit 'ELSE' to add +1 to quantity
COMPLETED and the 'count' incrementation is under a different issue
If you add an item already in basket, it should just add one more not duplicated
Maybe display 'added' on menu page or show the 'iteminbasket' on menu page