let array = [1...9]
func switchUp(_ value: Int) -> String? {
guard value > 0 && value < 10 else { return nil }
switch value {
case 1:
return "Один"
case 2:
return "Два"
default:
return nil
}
}
enum LocalizedValue: String {
case 1 = "Один"
case 2 = "Два"
case 3 = "Три"
}
let string = LocalizedValue.1.rawValue
[
"primes": [2, 3, 5, 7, 11, 13, 15],
"triangular": [1, 3, 6, 10, 15, 21, 28],
"hexagonal": [1, 6, 15, 28, 45, 66, 91],
].sorted { $0.key < $1.key }
// [
// (key: "hexagonal", value: [1, 6, 15, 28, 45, 66, 91])
// (key: "primes", value: [2, 3, 5, 7, 11, 13, 15]),
// (key: "triangular", value: [1, 3, 6, 10, 15, 21, 28]),
// ]
let frequents = "1[3333ddflsd111kfl1111sdkfls1111dfZ"
var D = [Character: Int]()
for elem in frequents
{
if D.keys.contains(elem){
D[elem] = D[elem]!+1;
}
else
{
D[elem] = 1
}
}
var max = D.first
for elem in D{
if elem.value > max!.value
{
max = elem
}
}
print(max!)