| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- // config: single_line_statement_blocks = "multi"
- function execute() returns (bool) {
- if (true) {
- // always returns true
- return true;
- }
- return false;
- }
- function executeElse() {}
- function executeWithMultipleParameters(bool parameter1, bool parameter2) {}
- function executeWithVeryVeryVeryLongNameAndSomeParameter(bool parameter) {}
- contract IfStatement {
- function test() external {
- if (true) {
- execute();
- }
- bool condition;
- bool anotherLongCondition;
- bool andAnotherVeryVeryLongCondition;
- if (
- condition && anotherLongCondition || andAnotherVeryVeryLongCondition
- ) {
- execute();
- }
- // comment
- if (condition) {
- execute();
- } else if (anotherLongCondition) {
- execute(); // differently
- }
- /* comment1 */
- if ( /* comment2 */ /* comment3 */
- condition // comment4
- ) {
- // comment5
- execute();
- } // comment6
- if (condition) {
- execute();
- } // comment7
- /* comment8 */
- /* comment9 */
- else if ( /* comment10 */
- anotherLongCondition // comment11
- ) {
- /* comment12 */
- execute();
- } // comment13
- /* comment14 */
- else {} // comment15
- if (
- // comment16
- condition /* comment17 */
- ) {
- execute();
- }
- if (condition) {
- execute();
- } else {
- executeElse();
- }
- if (condition) {
- if (anotherLongCondition) {
- execute();
- }
- }
- if (condition) {
- execute();
- }
- if (
- condition && anotherLongCondition || andAnotherVeryVeryLongCondition
- ) {
- execute();
- }
- if (condition) {
- if (anotherLongCondition) {
- execute();
- }
- }
- if (condition) {
- execute();
- } // comment18
- if (condition) {
- executeWithMultipleParameters(condition, anotherLongCondition);
- }
- if (condition) {
- executeWithVeryVeryVeryLongNameAndSomeParameter(condition);
- }
- if (condition) {
- execute();
- } else {
- execute();
- }
- if (condition) {}
- if (condition) {
- executeWithMultipleParameters(condition, anotherLongCondition);
- } else if (anotherLongCondition) {
- execute();
- }
- if (condition && ((condition || anotherLongCondition))) {
- execute();
- }
- // if statement
- if (condition) {
- execute();
- }
- // else statement
- else {
- execute();
- }
- // if statement
- if (condition) {
- execute();
- }
- // else statement
- else {
- executeWithMultipleParameters(
- anotherLongCondition, andAnotherVeryVeryLongCondition
- );
- }
- if (condition) {
- execute();
- } else if (condition) {
- execute();
- } else if (condition) {
- execute();
- } else if (condition) {
- execute();
- } else if (condition) {
- execute();
- }
- if (condition) {
- execute();
- } else if (condition) {
- execute();
- } else if (condition) {
- execute();
- } else if (condition) {
- execute();
- } else if (condition) {
- execute();
- } else {
- executeElse();
- }
- }
- }
|