-- FreeFem++ v4.14 (mer. 06 mars 2024 16:59:04 CET - git v4.14-1-g2b2052ae) file : exit_test.edp Load: lg_fem lg_mesh lg_mesh3 eigenvalue 1 : // exit_test.edp 2 : // 3 : // Discussion: 4 : // 5 : // This script simply demonstrates how the exit() command can be used 6 : // to abnormally terminate execution of a script. 7 : // 8 : // Licensing: 9 : // 10 : // This code is distributed under the MIT license. 11 : // 12 : // Modified: 13 : // 14 : // 23 May 2020 15 : // 16 : // Author: 17 : // 18 : // John Burkardt 19 : // 20 : cout << "\n"; 21 : cout << "exit_test():\n"; 22 : cout << " FreeFem++ version\n"; 23 : cout << " Show how the FreeFem++ 'exit()' statement\n"; 24 : cout << " can be used to terminate the execution of a scr ... : ipt.\n"; 25 : 26 : int j; 27 : 28 : for ( int i = 0; i <= 10; i++ ) 29 : { 30 : j = i * i; 31 : cout << " i = " << i << " and j = " << j << "\n"; 32 : 33 : if ( 10 < j ) 34 : { 35 : cout << "\n"; 36 : cout << "exit_test(): Fatal error!\n"; 37 : cout << " Abnormal end of execution.\n"; 38 : cout << " J exceeds tolerance!\n"; 39 : exit ( 1 ); 40 : } 41 : } 42 : // 43 : // Terminate. 44 : // 45 : cout << "\n"; 46 : cout << "exit_test():\n"; 47 : cout << " Normal end of execution.\n"; 48 : exit ( 0 ); 49 : sizestack + 1024 =1088 ( 64 ) exit_test(): FreeFem++ version Show how the FreeFem++ 'exit()' statement can be used to terminate the execution of a script. i = 0 and j = 0 i = 1 and j = 1 i = 2 and j = 4 i = 3 and j = 9 i = 4 and j = 16 exit_test(): Fatal error! Abnormal end of execution. J exceeds tolerance! current line = 39 exit(1) err code 1 , mpirank 0