When I put try in the beginning of a verb I expect it to catch all errors in
the verb.
It is not picking up the error when a name inn if. is not defined.

If I have undefined name in the verb then tr. catch picks it up but not when

try. catch. is not working when a name is undefined in an if statement


   v1 ''
ok

   v2=: 3 : 0
try. a=.3
if. b do. r=.'ok' end.
catch. r=.'not ok' end.
)

   v2 ''
|control error: v2
|       v2''
|[-0]





--------------------
   v=: 3 : 0

try.

2+3

a=. 3 4$ 1 4 6 2

NB. b + 3

NB. if. a do. 3 + 4 end.

NB. if. c do. 3 + 4 end.

a + 3

catch.

a + 4

end.

)

   v=: 3 : 0

try.

2+3

a=. 3 4$ 1 4 6 2

NB. b + 3

if. a do. 3 + 4 end.

NB. if. c do. 3 + 4 end.

a + 3

catch.

a + 4

end.

)

   v ''
4 7 9 5
4 7 9 5
4 7 9 5

   v=: 3 : 0

try.

2+3

a=. 3 4$ 1 4 6 2

NB. b + 3

if. a do. 3 + 4 end.

if. c do. 3 + 4 end.

a + 3

catch.

a + 4

end.

)

   v ''
|control error: v
|       v''
|[-0]




2008/2/27, Roger Hui <[EMAIL PROTECTED]>:
>
> All you are saying is that errors can happen in programs
> and some errors are tough to handle.
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to