User Tools

Site Tools


CIGAL Reference Manual, Chapter 2 (Commands): BREAK

BREAK -- Break out of a loop of conditional code

usage: break [N]

The BREAK command is used to exit from a block of conditional code within a WHILE or REPEAT loop in a CIGAL macro program. BREAK has no effect if called anywhere except within a loop. BREAK causes a jump to the end of the loop (indicated by a '}' command) and then continues, without going back up to test the WHILE condition again. The argument, N, indicates how many loops to jump out of (default: N=1). If N is givenm, it must be a constant, not a variable, because its value is read at compile time (rather than run time as for most arguments).

For example:

             while(a-- > 10) {
                b = a*c+d
                if(b > 100) break            ; skip next 8 lines
                type 'B=' b
                while(c++ < 20) {
                    if(d > 0) break 2    ; skip next 5 lines
                    if(b > 10) break     ; skip next 2 lines
                    type a b c d
                type 'D=' d++

See Also:

CIGAL Home, CIGAL Manual, Commands List, Manual Help

jvs/cigal/manual/chapter2/break.txt · Last modified: 2023/02/23 18:43 (external edit)