Understanding the `if` macro in Elixir

58
clicks
Understanding the `if` macro in Elixir

Source: reddit.com

Type: Discussion

The blog post by _Jarrisonn discusses their initial experience with learning Elixir, particularly focusing on the `if` macro. They explore the syntax of writing conditionals using `if foo do bar() else baz() end` and contemplate how the `do` and `else` parts function as arguments. They also wonder if it's possible to define macros with a similar syntax. Comments from users such as 831_ and ClickHereForBacardi recommend resources for deep dives into metaprogramming, while a3th3rus corrects a minor misunderstanding about the `if/2` macro.

© HashMerge 2024