Completed 100 Days of Swift - Day #1

This commit is contained in:
youngchief btw ツ 2020-04-08 19:17:30 -07:00
parent be559eb7c5
commit 4d32263bd1
7 changed files with 41 additions and 0 deletions

View File

@ -0,0 +1,3 @@
// Constants
let taylor = "swift"

View File

@ -0,0 +1,4 @@
// Doubles & Booleans
var pi = 3.141 // This is a double
var awesome = true // This is a boolean

View File

@ -0,0 +1,13 @@
// Multi-line strings
var str1 = """
This goes
over multiple
lines
"""
var str2 = """
This goes \
over multiple \
lines
"""

View File

@ -0,0 +1,5 @@
// String interpolation
var score = 85
var str = "Your score was \(score)"
var results = "The test results are here: \(str)"

View File

@ -0,0 +1,5 @@
// Strings & Integers
var str = "Hello, World!"
var age = 38
var population = 8_000_000

View File

@ -0,0 +1,7 @@
// Type annotations
let str = "Hello, World!"
let album: String = "Reputation"
let year: Int = 1989
let height: Double = 1.78
let taylorRocks: Bool = true

View File

@ -0,0 +1,4 @@
// Variables
var str = "Hello, World!"
str = "Goodbye"