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
return grammar
 
A directive that stops execution in the current context and supplies back to the parent context the value of the associated expression, if supplied. When called from the topmost context, the interpreter will be exited, but unlike an explicit exit call, no low order bits are supplied to the parent process of the interpreter. Its usage description can be summarized as follows:
Statement:
	return ExpressionOPT ;
 
 Example:   The following example uses return in a function to provide a pseudo-random number uniformly distributed between 0 and 100 to the parent.
import yoix.stdio.printf;

u100() {
    int r;
    do {
	r = 101.0 * yoix.math.random();
    } while(r == 101);
    return(r);
}

int r1 = u100();
int r2 = u100();
int r3 = u100();

printf("r1=%d, r2=%d, r3=%d\n", r1, r2, r3);
An sample of some output is:
r1=42, r2=96, r3=10
 
 See Also:  

 

Yoix is a registered trademark of AT&T Inc.