Code – Part 4 Adding an item to an Array | Swift Programming Series

Download the file here: Tutorial.playground

Watch the full video here:

Read the code below:

// Variables & Constants

let firstName = "Ben" // Constant

let lastName = "Tennyson"

let fullName = firstName + " " + lastName // String Concatenation

let interpolatedFullName = "My friend's name is \(firstName) \(lastName)" // String Interpolation



var age = 16 // Variable

print("\(firstName) is \(age) years old!")

// Gives Error!! print(firstName + " is " + age + " years old!")

var profession = "Student"

print("\(fullName) is a \(age) year old \(profession)!")

// ------------------------------

// Collection Types

// 1. Arrays

// 2. Dictionaries

// 3. Sets

// Arrays

// let example = [9, 100, 81, 23]

var todo: [String] = ["Complete Homework", "Buy a Notebook", "Record Swift Tutorial"]



var friendList: [String] = ["John", "Joe"]

// First method to add item to an Array




// Second method to add item to an Array

17 June 2017

Hey guys! It’s another summer day today & the temperature outside is so much hot. It’s almost like fire 🔥! So I finished up one of my tuition & have another one after some time. Right now, I was just watching some Swift Programming Tutorials on YouTube & then I thought that lemme make a post on my new blog! So am I doing right now. Anyways, if you are reading this, do me a favor, just follow me on Instagram: 😎

Hello, world!

So my new website is now up & running and if you are reading this you’re probably on my website so yeah! Feel free to make your way around my website & don’t forget to follow me on social platforms to always stay in touch!


Facebook [@rohantinnablog]:

Instagram [@rohantinna]:

Twitter [@rohantinna]:

Snapchat [@rohantinna]:

Powered by

Up ↑