ox

The Ox programming language, compiler and tools (WIP)
Log | Files | Refs | README | LICENSE

ex-while.ox (409B)


      1 void main() {
      2 
      3     print("before");
      4     int i = 1;
      5     while(true) {
      6         print("while true prints once 1/3");
      7         break;
      8     }
      9     while(1) {
     10         print("while 1 prints once 2/3");
     11         break;
     12     }
     13     while(0) {
     14         print("should never happen!");
     15         break;
     16     }
     17     while("in vino veritas") {
     18         print("while string prints once 3/3");
     19         break;
     20     }
     21     print("after");
     22 }