Smart contracts as if-then statements?


Is it accurate and correct to say that all smart contracts embody if-then statements/conditions? If we distill a smart contract to its basic functionality, a condition needs to be met for a certain event/outcome to happen - but is this always the case?

I understand that there needs to be a trigger, auto-enforcement and execution does not happen unless the wheels are set in motion first. So might the trigger constitute the “if” and whatever is programmed the “then”? Or is this sort of characterization of looking at smart contracts as if-then relationships just simply wrong?

1 Like

Hi @codingbibi,

I wouldn’t characterize a transaction to store a value on chain as if-then.

See the following example:

1 Like

Do you mean does it look like ECMAScript? It absolutely does.
The contracts were supposed to be immutable, therefore it was important to choose very simple to digest syntax and architecture. A bug could ruin everything, and going any further low level than Solidity goes could just make Ethereum fail.
But that’s one thing, there is another one, far more important: in order to stimulate adoption and decentralization, make Ethereum massive, an easy to digest language had to be chosen to achieve that. The most popular one and the simplest one. If, for example, Solidity was more C+±like, then the amount of confident Ethereum developers would be approaching zero(0). Wouldn’t help innovation pace much, to say the least.

1 Like

If you really simplify it, they kind of are. At its core, Ethereum is just a finite state machine.

More info:


Hi, welcome! :wave:

Thanks for sharing.