1.8 KiB
1.8 KiB
Hints
General
- Read about using
with
in the official Getting Started guide. - Review the functions available in the
NaiveDateTime
module, theDate
module, and theTime
module.
1. Get into the building
- Match the
:ok
tuple returned byenter_building/1
inwith
with<-
. - In the
do
part ofwith
, return an:ok
tuple with the value you just matched. - Since you don't need to modify the error, you don't need an
else
block.
2. Go to the information desk and find which counter you should go to
- Match the
:ok
tuple returned byfind_counter_information/1
inwith
with<-
. - Apply the anonymous function your just matched and match the result with
<-
. - In the
do
part ofwith
, return an:ok
tuple with the counter you obtained. - Add an
else
block that will expect a:coffee_break
tuple and return a:retry
tuple with aNaiveDateTime
. - A minute has
60
seconds. - There is a built-in function that adds a given number of seconds to a
NaiveDateTime
struct. - Other errors should be returned as they are.
3. Go to the counter and get your form stamped
- Match the
:ok
tuple returned bystamp_form/3
inwith
with<-
. - In the
do
part ofwith
, return an:ok
tuple with the checksum.
4. Receive your new passport
- In the
do
part ofwith
, useget_new_passport_number/3
and return the result in an:ok
tuple.