This is not valid elixir. If you want to update the map use %{x | job: "coder"}. Also you should be aware that if without an else will return nil, so your function will return nil if no employee was found.
But more generally this is not really ideomatic in the big picture as well. If you select employees by id then it makes more sense to store them in a map with the employee id as a key, which makes selecting employees quite a bit simpler.
def promote(map) do
emp_id =
"Enter employee ID to promote: "
|> IO.gets()
|> String.trim()
|> String.to_integer()
if Map.has_key?(map, emp_id) do
Map.update!(map, emp_id, fn current -> %{current | job: "coder"} end)
else
map
end
end






















