Difference between assign and update

What is the difference between functions assign and update and which to use when?

I know the update function will raise an error if the key does not exists, so why not use assign function everywhere? Probably there are more reasons behind the update, than simply want to make sure that key is present before we update it?

Even in the code, update uses assing: phoenix_live_view/phoenix_live_view.ex at v0.17.5 · phoenixframework/phoenix_live_view · GitHub

Same difference as Map.update! vs Map.put. One takes a function and applies it, while the other expects you to apply the function yourself beforehand, and then pass in the result. So the former could be seen as saving you an extra step in some cases.