ETHEREUM SMART CONTRACTS DEVELOPMENT

Solidity Fundamentals

Control Structures

Ferdi Kurt
Coinmonks
Published in
1 min readJan 6, 2021

--

Most of control structures that we are familiar from Javascript, C or Python are also exist in Solidity. There is if, else, while, do, for, break, continue, return with the common semantics from above mentioned languages. Let’s look at an example, and investigate each one of them:

While writing smart contracts, we may need to perform a specific action multiple times. Therefore we use loops to fulfill this need.

Solidity also supports exception handling in the form of try/catch statements, but only for external function calls and contract creation call. We will work on these topics in upcoming sections.

Next, we will be working on error handlingassert, require, revert and try/catch. Thanks for reading.

Feel free to ask any questions.

Stay safe, do good work, and keep in touch!

Ferdi Kurt

--

--