Lesson 1: The guessing game

Alchemist Camp is where you can learn the Elixir programming language by building projects. We'll get a solid foundation in Elixir and then use the Phoenix framework to build scalable, fault-tolerant web applications.

Welcome to Alchemist Camp!

Let's start at the very beginning. The first thing you'll need to do is install Elixir. Go to elixir-lang.org, click on the install tab and then follow the instructions for your OS. While you're on the site be sure to bookmark the docs. You'll be referring to them often as you learn! Next you'll need a text editor. If you don't already have a favorite editor, I recommend Visual Studio Code. As of early 2018, VS code is the number one project on Github in terms of contributor activity and it shows. The editor is head and shoulders ahead of competitors in terms of configurability, plugin support and in many cases, even speed.

Once you're set up, open your system terminal. VS code also has a handy integrated terminal you can open by pressing ctrl + `. Then type iex in the terminal. This is Elixir's integrated REPL. Try typing in some simple arithmetic expressions, strings, etc... poke around a bit. Try typing i before an expression to get "info" about how Elixir analyzes that expression. Note what happens when you divide an integer by another integer. Try using the div(a, b) and rem(a, b) functions.

At (10:47) of the video, we start writing a simple module. It's a guessing game that will iterative guess what number a user is thinking of, between some maximum value and some minimum value, and efficiently narrow in on an answer as the user responds with "too low" and "too high" feedback.

Source code for this episode

This lesson should get you set up and give you a good start with IO, functions, and modulo arithmetic in Elixir.

Challenge 1

See if you can make a program that asks the user's name and then greets them by name... and has a special response for users who enter your name.

Back to index