-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathContents.swift
More file actions
78 lines (69 loc) · 2 KB
/
Contents.swift
File metadata and controls
78 lines (69 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import UIKit
//noly one thing in each elemnt
var sponsors = ["adidas","Estee Lauder", "Carolina Herrera Good Girl", "Apple", "WeWork"]
//I am going to write a loop that prints all of our sponors
//each sponsorin the array sponsors, I am going to print their names
//sponsor is a new vairable so I can go throigh my array a new name
for sponsor in sponsors{
print("Shoutout to \(sponsor) for sponsoring KWK")
}
var capitals = ["France":"Paris","Cuba":"Havana", "Japan" : "Tokyo"]
//for pair in capitals{
//print(pair)
//}
//this for in looop prints keys and values seperately
//1st one = key 2nd one= value
//for (country,capital) in captials{
// //print countries only
// print(country)
// //print capitals only
// print(capital)
//}
//
//for in loop that prints and values sepeartely but it only uses one new variable
//for pair in capitals{
// //I want to only access the countries
// print(pair.key)
// //To acess only cities
// print(pair.value)
//
//}
//
//
////this prints out Hello 4 times beacuse it starts from 1 and ends at 4
//
//for _ in 1...20{
// print("Shoutout to KWK Scholars!")
//}
//
//}
//
//
//say I have two diffrent arrays
//assume they are the same size
//var arrayOne: [String] = []
//var arrayTwo: [String] = []
//
////declare a dictionary so that
////stuff in arrayOne becomes the keys
////stuff in arrayTwo becomes the values
////Store the location as the values
//var dictionary: [String:String] = [:]
//
//for(index, element) in arrayOne.enumerated(){
// dictionary[element]=arrayOne[index]
//
//}
//
////this shows the command enumarated
//Q1: What does the index stand for in the code
//A1: Each Animal
//Q2: What does animals.count represent?
//A2: .count is a command that gives you the number of elements in an array
//Q3: Bonus! What is ..< doing?
//A3: we have 3 animals but the highest index is 2, so less than will go from 0 to 2before
var animals = ["red panda" , "pengiun", "polar bear"]
for index in 0..<animals.count {
print("I love" + animals[index])
}
}