Today I Learned

hashrocket A Hashrocket project

Variable key names in Elixir

You can wrap strings and atoms with brackets in elixir to use them as keys in maps

var_key = :name
# This is the syntax for using that variable as a key name
%{[var_key] => "Jack Rosa"}
# => %{name: "Jack Rosa"}
See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.