Here is an example of an init function in Sui:
// This is an init function that sets the value of a global variable to 42
init {
let x = 42; // This is a local variable
Global::set(x); // This is a function call that sets the global variable to x
}
Swap insights and ask questions about “Learn everything about Move on Sui”.
Ask a question or share your thoughts about this lesson.