Created
October 5, 2022 12:34
-
-
Save SahilMutualMobile/970ec5be8e973874854e588131fbbc18 to your computer and use it in GitHub Desktop.
NewGenerics6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PizzaShop { | |
var orderNumber: Int = 1 | |
func onePlusOneOffer(order: some RestaurantItem) { | |
print("Order #\(orderNumber) starting") | |
for _ in 0 ..< 2 { | |
print(order.acceptOrderItem()) | |
print(order.prepareOrderItem()) | |
} | |
print("Order #\(orderNumber) complete") | |
orderNumber += 1 | |
} | |
func mealOrder(order: [any RestaurantItem]) { | |
print("Order #\(orderNumber) starting") | |
for item in order { | |
print(item.acceptOrderItem()) | |
print(item.prepareOrderItem()) | |
} | |
print("Order #\(orderNumber) complete") | |
orderNumber += 1 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment