Summary
Expressions and control structures are an integral part of any programming language, and they are an important element of the Solidity language as well. Solidity provides a rich infrastructure for decision and looping constructs. It provides if...else
decision control structures and the for
, do...while
, and while
loops for looping over data variables that can be iterated. Solidity also allows us to write conditions and logical, assignments, and other types of statement that any programming language supports. Knowledge of expressions and control structures helps in writing conditions and functional code that can evaluate expressions at runtime, loop over multiple values, and return values to callers from functions. They are an important part of any programming language, and knowing them helps to write better smart contracts in Solidity.
The following chapter will discuss Solidity and contract functions in detail; these are core elements for writing contracts. Blockchain is...