Sir R. M8gic1an
2008-05-09 07:04:42
i really think this is better fit in SRL Library, but since the other thread got moved here >.>
anyway, yesterday i need to make sure my bitmaps we're freed at the end of a function. I had seen wizzup? using the finally command before but i didn't remember too well how he had done it.
so i went into srl chat and asked if anyone knew how to use it. bullzeye was there and gave me an example with try except and finally. finally would run independently from try finding a runtime error or not. in his opinion finally was pretty much useless. i played around with it for a bit.
he was happy to find a new way to use finally.
by putting try wait(1); you lose only 1 or 2 ms and you get to call the finally command. i used it to ensure i'd free the bitmaps. notice that although i called exit; it still did what was after finally.
~RM
anyway, yesterday i need to make sure my bitmaps we're freed at the end of a function. I had seen wizzup? using the finally command before but i didn't remember too well how he had done it.
so i went into srl chat and asked if anyone knew how to use it. bullzeye was there and gave me an example with try except and finally. finally would run independently from try finding a runtime error or not. in his opinion finally was pretty much useless. i played around with it for a bit.
program New;
Procedure WriteThis;
begin
try wait(1);
writeln('some here 1');
writeln('some here 2');
exit;
writeln('some here 3');
writeln('some here 4');
finally
writeln('Using the Finally command!');
end;
end;
begin
WriteThis;
end.
Successfully compiled (222 ms)
some here 1
some here 2
Using the Finally command!
Successfully executed
he was happy to find a new way to use finally.
by putting try wait(1); you lose only 1 or 2 ms and you get to call the finally command. i used it to ensure i'd free the bitmaps. notice that although i called exit; it still did what was after finally.
~RM