TIL about key-value pairs in Elixir

Image for post
Image for post

Today I learned, that if you want to pass key-valued list in function, you can omit the brackets, e.g:

func_name key1: "value", key2: "another value"

It will be equals to this:

func_name [key1: "value", key2: "another value"]

UPD: Thanks to Dragos Tudorache to leave a little note about it. List of tuples have to be the last argument of a function :)

Have fun and program Elixir 🍶

Software Engineer at Yandex N. V.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store