-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(docs): explain how storage variables get updated #1311
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default value of [state variables](#variables) is assigned before any values could be assigned in the `init(){:tact}` function. | ||
|
||
```tact | ||
contract Example { | ||
// persistent state variables | ||
var1: Int = 0; // initialized with default value 0 | ||
|
||
// constructor function | ||
init() { | ||
self.var1 = 42; // overrides the default to 42 | ||
} | ||
} | ||
``` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a duplicate of the example above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was the intent, but yeah, I'll remove it
Sure, I'll add more while removing the redundancies.
Well, it wasn't labeled as a doc issue, but as a testing & typechecker, so I don't think this PR needs to be marked as closing it. |
Issue
Closes #1095.
Checklist