Rise In Logo



Learn everything about Move on Sui

Init Function

  • It is used to initialize a specific state of the application before any other code runs.
  • It returns nothing.
  • It can be defined multiple times in a package.
  • The order of execution of the init functions depends on the order of their declaration in the code.

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
}

Comments

You need to enroll in the course to be able to comment!

Stay in the know

Never miss updates on new programs and opportunities.

Rise In Logo

Rise together in web3!

Disclaimer: The information /programs / events provided on https://patika.dev and https://risein.com are strictly for upskilling and networking purposes related to the technical infrastructure of blockchain platforms. We do not provide financial or investment advice and do not make any representations regarding the value, profitability, or future price of any blockchain or cryptocurrency. Users are encouraged to conduct their own research and consult with licensed financial professionals before engaging in any investment activities. https://patika.dev and https://risein.com disclaim any responsibility for financial decisions made by users based on information provided here.