From 2cfb6b4ebfc5401b8666e5a73252f706f37208f3 Mon Sep 17 00:00:00 2001 From: Orvybr0wn1 Date: Sun, 16 Dec 2018 16:34:28 -0500 Subject: [PATCH] First Playground --- .DS_Store | Bin 0 -> 8196 bytes .../Pages/main.xcplaygroundpage/Contents.swift | 17 +++++++++-------- swift-firstTask-playground-swift-intro-000 | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) create mode 100644 .DS_Store create mode 160000 swift-firstTask-playground-swift-intro-000 diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..60151437750d8f0b1cf92db05a84f77d3e0bfadf GIT binary patch literal 8196 zcmeHM&2G~`5T0#AW2*vkKx&S@AR&}i4pix-NFfae4oF3=KnPH42Q zE{Hb(@i1IDaOMs#!t75Yo3yA!3IZ_`?R=Zrnf>{^S$iA+V6Bl~2dDyofkj|t71b#s z+C`a@C2hHa$S@wlZrypo`-3@8G7tmA05L!e5Cg=(-@*XivxOLE-1k*0X<~pF_%9g{ z=YxesU{hnJP#ztqWD0;-LbDXCS40KT(%96PDZ~~Ora}=_DAOqhQ{ia0v|m$Wrci|g z)5!f_VmL(GDXgG19~B^f ziDYseZ1M5Zc%ZM_XKxS&abnwF+0t_9(n{Gdj8)^Z@!aY0)JfcA6t~>rQ}J!rO?sZL z?{OZ^>aO=F=%o9VYdbtj+#u=4OiU<1!^eb&QO^?jy4U~M5}6}A|= zkuGYS{6>7YZ64|$(?Zsi->!=utFWodnYdsJS<@?L7==9QV*e-419blvY?BZJ=VoA8 zc~(XKfA8$~|L5+H9Eky9;NN3_mD*0bh4Vgn-uih7BGlV6-n5M=|AzD!AMS!G%6fy8e8TbLUDHsd@ literal 0 HcmV?d00001 diff --git a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift index ebe55fd..eaa6409 100644 --- a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -15,15 +15,15 @@ ### 1. Create a variable which represents your bank account balance. (For example: What is a good name for this variable that makes it easily readable for myself now and for the future me _or_ other developers I might be working with? Should I declare it using `let` or `var`? Should it be of type `Int` or `String`?) */ // write your code here - - +var bankBalance:Int? +bankBalance = 800 /*: question2 ### 2. You went to your local pet store and purchased yourself a puppy. You decided to name the puppy Bella. Once you named her, that name will stick with her forever. Create a variable that stores the name of your new puppy. */ // write your code here - +let myPuppy = "Bella" @@ -31,7 +31,7 @@ ### 3. Use the `print()` function to print the name of your new puppy to the console. */ // write your code here - +print(myPuppy) @@ -39,7 +39,7 @@ ### 4. Use the `print()` function to print the sentence "I just got a new puppy named and she is awesome!" to the console. */ // write your code here - +print("I just got a new puppy name \(myPuppy)") @@ -47,7 +47,7 @@ ### 5. Use the `print()` function to print the sentence "I have $ in my bank account." to the console. */ // write your code here - +print("I have $\(bankBalance!)") @@ -55,6 +55,7 @@ ### 6. Congratulations! You just got $100 for your birthday, so now you have $100 more in your bank account. Update your bank account with the new balance and print "I now have $." to the console. */ // write your code here +bankBalance = bankBalance! + 100 @@ -63,8 +64,8 @@ ### 7. You decided you don't like the name Bella. Change your puppy's name to something else. (Can you do this? What happens when you try? Why?) */ // write your code here - - +//you cannot change a constant +//myPuppy = "scotty" /*: Checkout the solution branch - git co solution or git checkout solution and then scroll back down to this very spot to see a link that directs you to the solutions to the above questions. diff --git a/swift-firstTask-playground-swift-intro-000 b/swift-firstTask-playground-swift-intro-000 new file mode 160000 index 0000000..85d32a5 --- /dev/null +++ b/swift-firstTask-playground-swift-intro-000 @@ -0,0 +1 @@ +Subproject commit 85d32a501a5176ee7d1740fc67518a71b1851c1a