Hi all !

I tried the exception handling. It works sometimes. It does not always work? J can not give errors because the exception handling does not always work? There is no way to fix it so we have to accept random results of our programs instead of errors?

p=: 3 1 0 2

q=: 3 1 1 0

A=: A. :: (!@#)

A p

20

A q

24

A. q

|index error

| A.q

a=: 3 : 0

try.

A. y

catch.

'error'

end.

)

a q

error


Cheers,

Erling


Den 2017-09-21 kl. 14:33, skrev Raul Miller:
Sure, and, for example:

typetrap=:4 :0
   try.
     x/y
   catch.
     'this is a trap'
   end.
)

    1 typetrap 1
this is a trap

Or, if you want some other kind of result (or if you want to see valid
arguments):

    +`'' typetrap i.4
6

No problem, right?

Thanks,


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to