for i in 1...10{
print(i)
}
var num = 0
for j in 1...10{
num += j
print(num)
}
//collection array
let players:[String] = ["hi","hello","hlo"]
for player in players{
print("player is \(player)")
}
//collection dictionary
let scores:[String:Int] = ["vijay":10,"sharma":20,"dhoni":30]
for score in scores.values{
print("player score is \(score)")
}
for player in scores.keys{
print("\(player)")
}
for (player,score) in scores{
print("\(player) score is \(score)")
}
print(i)
}
var num = 0
for j in 1...10{
num += j
print(num)
}
//collection array
let players:[String] = ["hi","hello","hlo"]
for player in players{
print("player is \(player)")
}
//collection dictionary
let scores:[String:Int] = ["vijay":10,"sharma":20,"dhoni":30]
for score in scores.values{
print("player score is \(score)")
}
for player in scores.keys{
print("\(player)")
}
for (player,score) in scores{
print("\(player) score is \(score)")
}
Sign up here with your email
ConversionConversion EmoticonEmoticon