Hi guys,

after reading some AoA's sections, I've an issue when I try to catch some exceptions inside a forever loop.
The thing is: although the exceptions catchs are declared inside the forever loop, when the loop exits and then other code are performed, it's possible to catch the exceptions declared befor again... but, like I said, the exceptions were declared just inside the forever loop!

Here is the code:
program p2_8_8;

#include( "stdlib.hhf" )
var
i8: int8;
i16: int16;

begin p2_8_8;
forever
try
stdout.put("Please, enter an integer between -128 and 127: ");
stdin.geti8();
mov(al,i8);
break;
exception (ex.ConversionError);
stdout.put("The entered value is not a valid Integer!",nl);
exception (ex.ValueOutOfRange);
stdout.put("The entered value is not in specified range!",nl);
endtry;
endfor;
stdout.put("Please, enter an integer between -32768..32767: ");
stdin.geti16();
mov(ax,i16);
stdout.put
(
"Entered values were: ",nl,
i8:12, nl,
i16:12, nl
);
end p2_8_8;


If I wasn't very clear... please forget me :oops:

Regards,

Carlos.
Posted on 2004-12-08 12:26:15 by cmontemu
Hi Carlos,

insert an unprotected statement do the trick



...
try
stdout.put("Please, enter an integer between -128 and 127: ");
stdin.geti8();
mov(al,i8);
unprotected
break;
exception (ex.ConversionError);
stdout.put("The entered value is not a valid Integer!",nl);
exception (ex.ValueOutOfRange);
stdout.put("The entered value is not in specified range!",nl);
endtry;
...

for more info read http://webster.cs.ucr.edu/AoA/Windows/HTML/AdvancedControlStructures.html#998406
Posted on 2004-12-08 17:11:03 by arlequin