5. Functions

Functions are code segments that take input and produce output. They help break down program code into logical components.

BigBang has numerous built-in functions, some of which were introduced in previous chapters. A comprehensive list is beyond the scope of this book, but you can consult the official BigBang Language Reference for more information. The focus will be on defining custom functions and examining the different types of functions: public, private, and read-only.

  • Public functions can be called externally by another standard or contract principal, requiring a transaction fee.

  • Private functions can only be called by the current contract with no outside access.

  • Read-only functions can be called externally without changing the chain state. Transactions are not required for read-only function calls.

Last updated