AT&T Home | AT&T Labs | Research
AT&T Labs, Inc. - Research

The Yoix® Scripting Language

Home | What's New | Grammar | Documentation | Download | License | YChart | YDAT | YWAIT | Byzgraf | FAQs
break grammar
 
A flow control statement that stops the execution of a loop and continues execution at the statement that follows the loop. break is also be used to stop execution in a switch statement. Its usage description can be summarized as follows:
Statement:
	break ;
 
 Example:   An example of break first used in a loop and then in a switch statement is:
import yoix.util.Calendar.*;

int i;
Calendar c;

stdout.nextline = "So far, this week:";

for (i = 0; i < 10; i++) {
    stdout.nextline = "day " + toString(i) + " began";
    if (i == c.dayofweek)
	break;
    stdout.nextline = "day " + toString(i) + " ended";
}

stdout.nextline = "and here we are at:";

switch (i) {
    case SUNDAY:
	stdout.nextline = "Sunday";
	break;
    case MONDAY:
	stdout.nextline = "Monday";
	break;
    case TUESDAY:
	stdout.nextline = "Tuesday";
	break;
    case WEDNESDAY:
	stdout.nextline = "Wednesday";
	break;
    case THURSDAY:
	stdout.nextline = "Thursday";
	break;
    case FRIDAY:
	stdout.nextline = "Friday";
	break;
    case SATURDAY:
	stdout.nextline = "Saturday";
	break;
    default:
	stdout.nextline = "in trouble!";
	break;
}
yields this sort of output:
So far, this week:
day 0 began
day 0 ended
day 1 began
day 1 ended
day 2 began
day 2 ended
day 3 began
day 3 ended
day 4 began
and here we are at:
Wednesday
 
 See Also:   do, for, Object, Pointer, reference, switch, while

 

Yoix is a registered trademark of AT&T Inc.