Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //associative array
- var userGrades:[String:Int] = [:]
- userGrades["Neo"]=0
- userGrades["Shlomi"]=100 //becuase i affraid from shlomi
- userGrades["Gal"]=100
- userGrades["Faiz"]=100
- userGrades["Michel"]=60 //becuase i am a racist
- print (userGrades)
- userGrades["Michel"]=65
- print (userGrades)
- print (userGrades["Shlomi"]!)
- var userId:[Int:String] = [:]
- userId[723784]="Neo"
- userId[387234]="Faiz"
- print (userId)
- print ("\(userId[723784]!) wants badly \(userId[387234]!)")
- //set - stores only unique values
- var mySet = Set<String>()
- mySet.insert("zeev")
- mySet.insert("nipo")
- mySet.insert("amital")
- mySet.insert("nipo")
- print (mySet)
- print (mySet.count)
- var check=mySet.contains("nipo")
- print ("we have the dog here? \(check)")
- //if commands
- if mySet.contains("neo") && mySet.contains("zeev")
- {
- print ("nipo is still alive, how sad")
- }
- else
- {
- print ("finnaly, freedom !!!!")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement