🎉 I just finished Day 3 of the #100DaysOfSwiftUI at https://www.hackingwithswift.com/100/swiftui/3 via @twostraws
today's learning:
How to store ordered data in arrays
How to store and find data in dictionaries
How to use sets for fast data lookup
sample code:
var beatles = ["John", "Paul", "George", "Ringo"]
let numbers = [4, 8, 15, 16, 23, 42]
var tempratures = [25.3, 28.2, 26.4]
print(beatles[0])
print(numbers[1])
print(tempratures[2])
beatles.append("Adrian")
let employee2 = [
"name": "Taylor Swift",
"job": "Singer",
"location": "Nashville"
]
print(employee2["name", default: "Unknown"])
print(employee2["job", default: "Unknown"])
print(employee2["location", default: "Unknown"])
enum Weekday {
case monday
case tuesday
case wednesday
case thursday
case friday
}
var day = Weekday.monday
day = Weekday.tuesday
day = Weekday.friday
No comments:
Post a Comment