-- FreeFem++ v4.6 (Thu Apr 2 15:47:38 CEST 2020 - git v4.6) 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 : // Location: 9 : // 10 : // http://people.sc.fsu.edu/~jburkardt/freefem_src/exit_test/exit_test.edp 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 << " Show how the FreeFem++ 'exit()' statement\n"; 23 : cout << " can be used to terminate the execution of a scr ... : ipt.\n"; 24 : 25 : int j; 26 : 27 : for ( int i = 0; i <= 10; i++ ) 28 : { 29 : j = i * i; 30 : cout << " i = " << i << " and j = " << j << "\n"; 31 : 32 : if ( 10 < j ) 33 : { 34 : cout << "\n"; 35 : cout << "exit_test - Fatal error!\n"; 36 : cout << " Abnormal end of execution.\n"; 37 : cout << " J exceeds tolerance!\n"; 38 : exit ( 1 ); 39 : } 40 : } 41 : cout << "\n"; 42 : cout << "exit_test:\n"; 43 : cout << " Normal end of execution.\n"; 44 : exit ( 0 ); 45 : sizestack + 1024 =1088 ( 64 ) exit_test 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 = 38 exit(1) err code 1 , mpirank 0