CDE
This commit is contained in:
parent
518da4a923
commit
764da6cbbb
6144 changed files with 83610 additions and 11 deletions
17
Task/Exceptions/Haskell/exceptions-6.hs
Normal file
17
Task/Exceptions/Haskell/exceptions-6.hs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import Exceptions
|
||||
|
||||
procedure main(A)
|
||||
every i := !A do {
|
||||
case Try().call{ write(g(i)) } of {
|
||||
Try().catch(): {
|
||||
x := Try().getException()
|
||||
write(x.getMessage(), ":\n", x.getLocation())
|
||||
}
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
procedure g(i)
|
||||
if numeric(i) = 3 then Exception().throw("bad value of "||i)
|
||||
return i
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue