Chapter 4: Global Variables and Functions
In Chapter 3, Introducing Solidity, you learned about Solidity data types in detail. Data types can be of values or reference types. Some reference types such as structs and arrays also have data locations – memory and storage associated with them. Variables can be state variables or variables defined locally within functions. This chapter will focus on variables, their scoping rules, declaration and initialization, conversion rules, and variables available globally to all contracts. Some of the important global functions will be discussed in this chapter, while others will be discussed in subsequent chapters. These global variables are functions that are very important while authoring smart contracts. Global variables provide runtime information about the current execution of the smart contract and internal state, while global functions help write advanced smart contracts, such as destroying smart contracts and calling functions in...