State Variables
  • Declared at contract level.
  • Permanently stored in contract storage.
  • Can be set as constants.
  • Expensive to use they cost gas.
  • Initialised at declaration using a constructor or after contract deployment by calling Setters Functions.
Local Variables
  • Declared inside functions.
  • If using the memory keyword and are structure they are allocated at run time memory keyword cannot be used at contract level.
  • Memory mainly use with address or string variables.
Video : Solidity Variable
Resource File
Question / Answer

State Variable and Local Variable
Bibliography/References
  • None