User storage user
can be defined as the instance of an struct, its a variable called user
with the structure based on the User
struct, and the value already exist in storage
, its value will be users[id]
So, we create an instance of an stored values with User storage user = users[id]
so we can later modify the storage
directly.
Struct instances can be stored/located in memory
or storage
. It just depends how we want to use them. Storing them in memory isn’t wrong if we don’t need to store their values persistently e.g. if we just need them temporarily to perform some kind of operation within the function.
Carlos Z