Question: Stopping the program

Two examples:

for i in {1, 2/0, -3, 1/4, 5} do

if i::posint then print(i)  fi;

od;

       Error, numeric exception: division by zero

 

select(x->is(x::posint), {1, 2/0, -3, 1/4, 5});

       Error, numeric exception: division by zero

 

How to avoid interruption of the program in such cases?

Please Wait...