Control structures
Solidity supports if
, else
, while
, for
, break
, continue
, return
, ? :
control structures.
Here is an example to demonstrate the control structures:
contract sample{ int a = 12; int[] b; function sample() { //"==" throws exception for complex types if(a == 12) { } else if(a == 34) { } else { } var temp = 10; while(temp < 20) { if(temp == 17) { break; } else { continue; } temp++; } for(var iii = 0; iii < b.length; iii++) { } } }