// exit_test.edp // // Discussion: // // This script simply demonstrates how the exit() command can be used // to abnormally terminate execution of a script. // // Location: // // http://people.sc.fsu.edu/~jburkardt/freefem_src/exit_test/exit_test.edp // // Licensing: // // This code is distributed under the MIT license. // // Modified: // // 23 May 2020 // // Author: // // John Burkardt // cout << "\n"; cout << "exit_test\n"; cout << " freefem++ version\n"; cout << " Show how the FreeFem++ 'exit()' statement\n"; cout << " can be used to terminate the execution of a script.\n"; int j; for ( int i = 0; i <= 10; i++ ) { j = i * i; cout << " i = " << i << " and j = " << j << "\n"; if ( 10 < j ) { cout << "\n"; cout << "exit_test - Fatal error!\n"; cout << " Abnormal end of execution.\n"; cout << " J exceeds tolerance!\n"; exit ( 1 ); } } // // Terminate. // cout << "\n"; cout << "exit_test:\n"; cout << " Normal end of execution.\n"; exit ( 0 );