Want to learn?
Elixir Course Online | Prograils - Software Development Company
Control flow exercises
Exercises
You're going to write a game menu simulator. When a user passes a number from 1 to 5 range you should print the following messages:
- 1 - "Continuing saved game"
- 2 - "Starting new game"
- 3 - "Loading saved game"
- 4 - "Opening options"
- 5 - "Quitting game"
You should not worry about user interaction. The number can be bound to a variable, for example:
iex> option = 3 # implementation goes here # result is printed below iex> "Loading saved game"
You should solve this exercise with three control flow mechanisms: if, cond and case. Remember, to print default message when wrong options are given.