If I don't specify the function variable as storage or memory, what should be the default keyword?

  • It is an error if you don't specify the default visibility.
    – Ismael
    Jun 4, 2022 at 2:08

2 Answers 2


Variable state defining is important for new versions of solidity. Storage variable stores permanent storage in blockchain and is quite expensive to use. Memory variable is stored temporarily and is cheaper to use.



If you are declaring a variable that is storing a string then it is an error if you do not specify the variable as storage

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.