BREAK, CONTINUE, GOTO
(高顯忠, sjgau4311@gmail.com, 2011-04-24 07:14)
1樓
FOR I=1 TO 40 STEP 1
IF (偶數) CONTINUE
IF (質數) GOTO L100;
IF (I == 23) BREAK;
PRINT I;
L100: CONTINUE
NEXT I
(高顯忠, sjgau4311@gmail.com, 2011-04-24 07:43)
2樓
// fille: XXX.CPP
#include <stdio.h>
// Example of the goto statement
void main()
{
int i, j;
for ( i = 0; i < 10; i++ )
{
printf( "Outer loop executing. i = %d\n", i );
for ( j = 0; j < 3; j++ )
{
printf( " Inner loop executing. j = %d\n", j );
if ( i == 5 )
goto stop;
}
}
/* This message does not print: */
printf( "Loop exited. i = %d\n", i );
stop: printf( "Jumped to stop. i = %d\n", i );
}
#if 0
int main()
{
//
return 0;
}// end of main()
#endif
// end of file