Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct InventoryList< T > {
- var items: [T]
- mutating func add(item: T) {
- items.append(item)
- }
- mutating func remove() -> T {
- return items.removeLast()
- }
- func isCapacityLow() -> Bool {
- return items.count < 3
- }
- func numberOfItems() -> Int {
- return items.count
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment