From d7392a6f340be6c80758d6b578c77198a266a58b Mon Sep 17 00:00:00 2001 From: Simone Grant Date: Fri, 16 Sep 2016 13:33:42 -0400 Subject: [PATCH] Variables and Constants --- .DS_Store | Bin 0 -> 6148 bytes .../Pages/main.xcplaygroundpage/Contents.swift | 15 ++++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) create mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..05585a8deda6ba241ee37ec52718d323591103e5 GIT binary patch literal 6148 zcmeHKJx{|x41ItUkl_|L#NQ#h_I-?Tg(+9P zy8bE7af~OFld67LRP}<9O4Awjs0~67*u@3Ec8r1*=Cpk|?`t^+xWpT-QQ@BWh*#8D z;u$5gUp9NYE0CF1qe|P-0y|uHfm7tH+B?5|Flu$pASKaL>@K zGvEw31K$kj{*X`=(};~>*g9y!6M(4K=pgj5%yNkT~<#<3+;kte=E%NNVWT8E^)=3~XC-r00LZU#9nw-%atBGvEyTF$QFi z&-08Q70=d<&(pIuq25tdG_FyHLcenfU_0fvFF!-4 literal 0 HcmV?d00001 diff --git a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift index ebe55fd..32f5ac1 100644 --- a/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift +++ b/MyPlayground.playground/Pages/main.xcplaygroundpage/Contents.swift @@ -15,7 +15,7 @@ ### 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 cashBalance: Int = 2 @@ -23,7 +23,7 @@ ### 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 pupName: String = "Bella" @@ -32,7 +32,7 @@ */ // write your code here - +print(pupName) /*: question4 @@ -40,7 +40,7 @@ */ // write your code here - +print("I just got a new puppy name \(pupName) and she is awesome!") /*: question5 @@ -48,7 +48,7 @@ */ // write your code here - +print("I have $\(cashBalance) in my bank account") /*: question6 @@ -56,14 +56,15 @@ */ // write your code here - +cashBalance = 100 +print("I now have $\(cashBalance).") /*: question7 ### 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 - +//Cannot change a constant /*: 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.