top of page
Search

Let's Play With Xcode Playground

  • rollingcoders
  • Sep 2, 2017
  • 1 min read

Let's play with Xcode Playground...

- Constant "let"

- Variable "var"

- Print(str)

- \n = new line

- str = "Hello World" ; str = "Hello RollingCoders"

- let myName = "Megan"; myName = "Natalie"

- Naming convention lowerCaseThenUpperCase

- When to use var and when to use let (think of # of windows)

- You can name let and var anything you want, but can't use Swift reserved words

- Camel case. Descriptive names!

- Data type. You don't want to use a basket to hold water right? :)

- Window is an int (you can't have a 1/2 of a window, right?

- Once declare, the type will be the same forever

- Variable and Constant only hold the data type that it is defined to do (cannot hold 1.5 in int).

- Int, Double, Float, Bool, String.

- var bananaPrice: Double = 1.25

- swiftIsFun = true

- What is Concatenation?

- What is type inference, for example 3.14 or = True?

- Casting (temporary change a value) - Int(days); print(days)

- +, -, /, *, % (use math operator on same data type); try multiply age by multiplier. Now, cast a the age.

- Space must be consistent, either space before and after or none.

- Ordering operation ( and )

- Operator long form & short form ( a += b; a = a +b, etc.)

------------

Homework

Write a program to calculate number of animals on Noah Ark (pick your 7 favorite pair of animals use let and var accordingly)

* Must use += operator

* Must use var and let


 
 
 
Featured Posts
Recent Posts
Archive
Search By Tags
Follow Us
  • Facebook Basic Square
  • Twitter Basic Square
  • Google+ Basic Square

Follow us - coming soon...

© 2017 by RollingCoders Kids
 

Call

T: (408) 656-9623

  • Facebook Clean
  • Twitter Clean
  • White Google+ Icon
bottom of page