Be yourself; everyone else is already taken. -Oscar Wilde
- Create variables and constants using
let
andvar
. - Use the
print()
function to print theirString
types to the console. - Create variables of type
String
andInt
. - Create variables using type inference and type annotations.
- Use string interpolation to print out
String
literals to the console.
This is your first lab. Some labs require that you open up Xcode, other labs ask that you open up the playground file. What does that mean?
If you aren't familiar with Xcode, read this. If you aren't familiar with how tests work and what your interaction will be with them, read this next.
This lab is asking that you open up a playground file, and we'll walk you through those steps. The playground file has no tests in it.
First things first, you should clone down this repository. If you aren't familiar with how to do that or the process of submitting labs, you should read this.
After cloning down this project, you should locate the directory in Terminal or locating it through finder.
Example of locating the directory in Finder:
Example of locating the directory in Terminal:
Open up the MyPlayground.playground
file. After doing so, you should see the following:
If you see something like this instead, then you need to make sure Render Documentation is checked.
You can check off the Render Documentation by opening up the Utilities pane (top right box thing) and then check it off like so:
Here's how you should be answering these various questions. We like to delete where it states
// write your code here
Then replace that section with what you think the answer is.. like so:
What exactly is a Playground file? A playground is an interactive Swift coding environment that evaluates each statement and displays results as updates are made, without the need to create project. Here's an example:
Notice how in the right pane, the playground file is able to compile and run this code while I'm typing it in. That's awesome and makes it a really great tool to learn how to code. As you move forward in your "learning how to program" career, if you're ever challenged with a topic or want to brush up on some material, create your own playground by launching Xcode and just start writing some code!