Skip to content

Lesson4: Local vs State variables #1379

Answered by krakxn
r3lik asked this question in Q&A
Discussion options

You must be logged in to vote

@r3lik You are correct, it does not follow the DRY (Do not repeat yourself) principle. But as this is an introductory lesson, do not sweat it. Patrick takes care of that in the future. All the best!

The best solution to minimize gas and follow this principle is to make it of type constant -- and if it has to be initialized via a constructor, then a immutable type.

Hope this helps!

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by r3lik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants