Exercise: Language Selector
- Create a menu where people can pick a language by selecting the number next to the language.
- You have a list of languages in an array as we have in the skeleton.
examples/language-selector-skeleton/language_selector_skeleton.go
package main import ( "fmt" ) func main() { languages := [...]string{"English", "French", "Urdu", "Farsi", "Hungarian", "Hebrew"} fmt.Println(languages) }
- It displays a "menu" that associates each language with a number.
- The user types in one of the numbers.
- The code checks if it is a number and if it is in the correct range.
- If it is, then we display the selected language.
- The interaction will look like this:
1) English 2) French 3) Urdu 4) Farsi 5) Hungarian 6) Hebrew Select a number: 5 5 Selection: Hungarian