update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
16
Task/Exceptions/REXX/exceptions.rexx
Normal file
16
Task/Exceptions/REXX/exceptions.rexx
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/*REXX pgm to demonstrate handling an exception; catching is via a label*/
|
||||
do j=9 by -5 for 100
|
||||
say 'square root of' j "is" sqrt(j)
|
||||
end /*j*/
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
|
||||
.sqrtNeg: say 'illegal SQRT argument (argument is negative):' x
|
||||
exit /*exit (terminate) this program. */
|
||||
|
||||
/*─────────────────────────────────────SQRT subroutine──────────────────*/
|
||||
sqrt: procedure; parse arg x; if x=0 then return 0; d=digits();numeric dig
|
||||
g=.sqrtGuess(); do j=0 while p>9; m.j=p; p=p%2+1; end
|
||||
do k=j+5 to 0 by -1; if m.k>11 then numeric digits m.k; g=.5*(g+x/g)
|
||||
numeric digits d; return g/1
|
||||
.sqrtGuess: if x<0 then signal .sqrtNeg; numeric form; m.=11; p=d+d%
|
||||
parse value format(x,2,1,,0) 'E0' with g 'E' _ .; return g*.5'E'_%
|
||||
4
Task/Exceptions/Seed7/exceptions-1.seed7
Normal file
4
Task/Exceptions/Seed7/exceptions-1.seed7
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
const proc: foo is func
|
||||
begin
|
||||
raise RANGE_ERROR;
|
||||
end func;
|
||||
9
Task/Exceptions/Seed7/exceptions-2.seed7
Normal file
9
Task/Exceptions/Seed7/exceptions-2.seed7
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
const proc: main is func
|
||||
begin
|
||||
block
|
||||
foo;
|
||||
exception
|
||||
catch RANGE_ERROR:
|
||||
writeln("catched RANGE_ERROR");
|
||||
end block;
|
||||
end func;
|
||||
Loading…
Add table
Add a link
Reference in a new issue