Swift equivalent for ex19.py

Python example:

def cheese_and_crackers(cheese_count, boxes_of_crackers):
    print(f"You have {cheese_count} cheeses!")
    print(f"You have {boxes_of_crackers} boxes of crackers!")
    print("Man thats enough for a party!")
    print("Get a blanket.\n")

> cheese_and_crackers(22, 33)

Swift equivalent:

func cheese_and_crackers(cheese_count: Int, boxes_of_crackers: Int) {
    print("You have \(cheese_count) cheeses!")
    print("You have \(boxes_of_crackers) boxes of crackers!")
    print("Man thats enough for a party!")
    print("Get a blanket.\n")
}

> cheese_and_crackers(cheese_count: 22, boxes_of_crackers: 33)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s