Bot program to count the products bought in the supermarket, with total sum.
void main() { var myProducts = ["Apple:10", "Banana:5", "Milk:20", "Eggs:40"]; var total = 0; for(var product in myProducts) { var name = product.split(":")[0]; var price = int.parse(product.split(":")[1]); total += price; print("$name costs $price"); } print("You have to pay a total of $total"); }