statement_do_while.sol 511 B

1234567891011121314151617181920212223
  1. contract Foo {
  2. function bar(uint256 n) public returns (bool) {
  3. return false;
  4. }
  5. function foo(uint256 n) public {
  6. do {
  7. n--;
  8. if (n >= 100) {
  9. // do not execute the if statement below, but loop again
  10. continue;
  11. }
  12. if (bar(n)) {
  13. // cease execution of this while loop and jump to the "n = 102" statement
  14. break;
  15. }
  16. } while (n > 10);
  17. n = 102;
  18. }
  19. }