Unpack a telescope result
Before you start this advanced track
Functions and collections. Work with immutable data, tuples, atoms, and pattern matching.
Guided code reading and debugging. Runnable coding challenges are available in JavaScript, Python, and SQL.
Understand it, then try it.
An Elixir tuple can carry a status atom alongside a message. Pattern matching checks that its shape and status match what the program expects, then binds the message to a variable. The <> operator joins strings. This compact pattern is useful for handling successful results returned by other functions.
result = {:ok, "aligned"}{:ok, message} = resultreport = "Telescope: " <> messageIO.puts(report)Each mission is a standalone Elixir script run with elixir. Only standard-library modules are used. Answers describe printed output, excluding any extra value an interactive IEx session would echo.
Track the values line by line. Predict the result before running this example in your own editor.