Skip to content
Low-level programming · Higher-level thinking
Login Register
Forum / Requests and Feedback

break statement

A community discussion post from the original code:zIRON forum.

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

break statement

Hi

can Break take a parameter that allow breaking in nested blocks.

for example

  repeat // outer loop
   {

     case(..)
      {
        state .....:
              break;  // break the case block

        state .....:
               break 1;  // break the repeat block and so on break 2 ....etc
      }
   };
  

http://www.freewebs.com/ogremagic/index.htm

Replies

Colin admin
Posts
928
Threads
49
Location
Bulgaria

Yes, this is something i have been looking into, and infact break having a numbered parameter is a good idea, i will add this.

Colin admin
Posts
928
Threads
49
Location
Bulgaria

update: added :)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

good job. where is the updating?

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

for next release of course, for now you can do

  repeat // outer loop
   {

     case(..)
      {
        state .....:
              break;  // break the case block

        state .....:
               goto @exitloop;
      }

@exitloop:
   };
  
Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok thanks, nice work around.

http://www.freewebs.com/ogremagic/index.htm

Colin admin
Posts
928
Threads
49
Location
Bulgaria

sorry mistake

  repeat // outer loop
   {

     case(..)
      {
        state .....:
              break;  // break the case block

        state .....:
               goto @exitloop;
      }
   };
@exitloop:
  

*corrected :)

Emil_halim member
Posts
639
Threads
104
Location
Alex, Egypt

ok , i got the idea from first post. thank you.

http://www.freewebs.com/ogremagic/index.htm