Giter Club home page Giter Club logo

swift-firsttask-playground-swift-intro-000's Introduction

Variables

Oscar Wilde

Be yourself; everyone else is already taken. -Oscar Wilde

Overview

This Playgrounds lab, you'll create and print variables and constants that represent string and integer types.

Learning Objectives

  • Create variables and constants using let and var.
  • Use the print() function to print their String types to the console.
  • Create variables of type String and Int.
  • Create variables using type inference and type annotations.
  • Use string interpolation to print out String literals to the console.

Instructions

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?

We introduced you to Xcode earlier in this course and we'll cover it in more detail in subsequent lessons. For now, know that 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, review the earlier lesson that covered 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:

dir

Example of locating the directory in Terminal:

dir2

Open up the MyPlayground.playground file. After doing so, you should see the following:

play

If you see something like this instead, then you need to make sure Render Documentation is checked.

instead

You can check off the Render Documentation by opening up the Utilities pane (top right box thing) and then check it off like so:

checks

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:

answer

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:

play

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!

Now.. move forward and complete this lab! After you're done, make sure you save your changes and follow the correct steps to making a Pull Request. Review the earlier lesson that covered this process if you need a refresher.

Good luck.

luck

View this lesson on Learn.co

swift-firsttask-playground-swift-intro-000's People

Contributors

annjohn avatar deadpool013 avatar jimcampagno avatar mdippery avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.