Solidity | Ishaanvi InfoSoft | Vishal Bharvesh
Decision Making
Decision-making statements, also known as conditional statements, determine program direction and flow by specifying boolean expressions evaluated to true or false, enabling or disabling code execution.

  • if statement − if and else ‘if and else’ statements check whether a condition is true or false. If the condition is true, it executes some particular set of codes and if the condition is false, it executes some other set of codes.
  • if.. else statement − if and else ‘if and else’ statements check whether a condition is true or false. If the condition is true, it executes some particular set of codes and if the condition is false, it executes some other set of codes.
  • if.. else if.. statement − Chain 'if and else' statements with extra 'else if' for additional conditions.
Video : Solidity Decision Making
Resource File
Question / Answer

if (condition)
{
	statement or block of code to be executed if condition is True
}

if (condition)
{
	statement or block of code to be executed if condition is True
}
else
{
	statement or block of code to be executed if condition is False
}

if (condition1) {
  // code
} else if (condition2) {
  // code
} else if (condition3) {
  // code
} else {
  // code
}
Bibliography/References
  • None