September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
19
Task/Exceptions/Prolog/exceptions.pro
Normal file
19
Task/Exceptions/Prolog/exceptions.pro
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
foo(X) :-
|
||||
\+ integer(X),
|
||||
throw(b('not even an int')).
|
||||
foo(X) :-
|
||||
\+ between(1,10,X),
|
||||
throw(a('must be between 1 & 10')).
|
||||
foo(X) :-
|
||||
format('~p is a valid number~n', X).
|
||||
|
||||
go(X) :-
|
||||
catch(
|
||||
foo(X),
|
||||
E,
|
||||
handle(E)).
|
||||
|
||||
handle(a(Msg)) :-
|
||||
format('~w~n', Msg),
|
||||
!.
|
||||
handle(X) :- throw(X).
|
||||
Loading…
Add table
Add a link
Reference in a new issue