So, as a newbie to Elixir lang, I am thoroughly confused with : (colons) on both sides of a variable!
:status is an atom, but we also find in maps or structs stuff like so:
%{
kkey: "success"
}
Is the kkey an atom? If so, how is this different from :kkey, the standard way of declaring an atom!
Another example to drive home the point:
IO.inspect(some_variable, label: "value of some_variable")
In this example, is label: considered an atom?
Furthermore, in Keyword List are all keys atoms?
Appreciate clarifications. Thanks!
Your assumptions are correct:
%{
kkey: "success"
}
is equivalent to:
%{
:kkey => "success"
}
For more information about Keyword lists, read the documentation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With