Want to learn?

Control flow exercises

Exercises

  1. 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.

Check our latest product - it's based on our experience of managing over 50-people strong company. The tool we're missing as a small company and not an enterprise.

humadroid.io is an employee and performance management software. It's an unique tool allowing everyone to be in the loop - by having up to date info about co-workers, time-off, benefits, assets, helping with one-on-ones, being a go-to place for company-wide announcements.

Check out humadroid.io
Top

Contact us

* Required fields

The controller of your personal data provided via this contact form is Prograils sp. z o.o., with a registered seat at Sczanieckiej 9A/10, 60-215 Poznań. Your personal data will be processed in order to respond to your inquiries and for our marketing purposes (e.g. when you ask us for our post-development, maintenance or ad hoc engagements for your app). You have the rights to: access your personal data, rectify or erase your personal data, restrict the processing of your personal data, data portability and to object to the processing of your personal data. Learn more.

Notice

We do not track you online. We use only session cookies and anonymous identifiers for the purposes specified in the cookie policy. No third-party trackers.

I understand
Elo Mordo!Elo Mordo!