statement_while_break.sol 606 B

1234567891011121314151617181920212223242526
  1. contract Foo {
  2. function bar(uint256 n) public returns (bool) {
  3. return false;
  4. }
  5. function foo(uint256 n) public {
  6. while (n >= 10) {
  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. // only executed if both if statements were false
  17. print("neither true");
  18. }
  19. n = 102;
  20. }
  21. }