Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Control flow in_elixir


Published on

This covers how pattern matching work in Elixir

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

Control flow in_elixir

  1. 1. Control Flow in Elixir by Anna Neyzberg @Aneyzb
  2. 2. Pattern Matching
  3. 3. A note about variables in Elixir …
  4. 4. Some Examples Maybe? Let’s take a look at tuples….
  5. 5. So how is this useful?
  6. 6. • An attempt to read the file my_app.config takes place. • If the attempt succeeds the file content are extracted to the variable contents. • If the attempt fails an error is raised. This is because returns a tuple in the form of - {:error, reason}
  7. 7. Multi-Clause Functions
  8. 8. Recursion….
  9. 9. Recursion Continued….
  10. 10. In Conclusion….. • In elixir the “=“ sign does not mean set this variable to something else • New initialized variables are bound to the term on the right hand side •Multi-clause Functions are functions that have multiple definitions and the same arity.
  11. 11. Thank you! Twitter: @Aneyzb Email: Credits: • • Juric, Sasa. Elixir In Action. Shelter Island: Maning Publishing, 2015 Resource: