We can use an array [String] to get the number text from its number.
let number = ["One", "Two", "Three", "Four", "Five"]
e.g. number[0] means "One"
How do I get a simple order number of the text in the array having just its text ("Five" etc.) using Dictionary?
I tried a function like that:
let number = ["One", "Two", "Three", "Four", "Five"]
func getNumber(_ numberText: String) {
if numberText == "One" {
print(0)}
if numberText == "Two" {
print(1)}
if numberText == "Three" {
print(2)}
if numberText == "Four" {
print(3)}
if numberText == "Five" {
print(4)}
}
getNumber("Two")
But it has nothing common with the initial array at the top. Please help guys