Skip to content

What does "s_variable" mean? #2970

Answered by alymurtazamemon
yyc13236 asked this question in Q&A
Discussion options

You must be logged in to vote

@yangyueche It is a Chainlink style guide, that in order to remember a variable whether it is a state variable, immutable variable, constant variable, or local variable. They introduce suffix for them, here s represent a state variable.

And someone can question why should we remember that.

So the answer is while writing contracts we can know which variable we are using if suppose it is a state variable so we will become careful to perform any operation on it because as you know performing operations on state variables cost gas. Read a state variable has different gas and updating/storing in a state variable has a different cost.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@krakxn
Comment options

Answer selected by alymurtazamemon
Comment options

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