This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let names = ["Halil", "Δ°brahim", "Yusuf", "Emre"] | |
let count = names.count | |
for i in 0..<count { | |
print("Person \(i + 1) is called \(names[i])") | |
} | |
// Person 1 is called Halil | |
// Person 2 is called Δ°brahim | |
// Person 3 is called Yusuf | |
// Person 4 is called Emre |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val names = arrayOf("Halil", "Δ°brahim", "Yusuf", "Emre") | |
val count = names.count() | |
for (i in 0..count - 1) { | |
println("Person ${i + 1} is called ${names[i]}") | |
} | |
// Person 1 is called Halil | |
// Person 2 is called Δ°brahim | |
// Person 3 is called Yusuf | |
// Person 4 is called Emre |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for index in 1..5 { | |
print("\(index) Halil Γzel") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for (index in 1..5) { | |
println("$index Halil Γzel") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var shoppingList = ["milk", "water", | |
"egg", "rice"] | |
shoppingList[1] = "bread" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val shoppingList = arrayOf("milk", "water", | |
"egg", "rice") | |
shoppingList[1] = "bread" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var occupations = [ | |
"Malcolm": "Captain", | |
"Kaylee": "Mechanic", | |
] | |
occupations["Kaylee"] = "Public Relations" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val occupations = mutableMapOf( | |
"Malcolm" to "Captain", | |
"Kaylee" to "Mechanic" | |
) | |
occupations["Kaylee"] = "Public Relations" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let emptyArray = [String]() | |
let emptyDictionary = [String: Float]() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val emptyArray = arrayOf<String>() | |
val emptyMap = mapOf<String, Float>() |