Frank D. Engel, Jr. wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Well, you can improve on that slightly at least (also untested, copy-paste-modify, ...)
No, that doesn't do the same thing.
The modified code will do something1, then fall through to do something2 (without having incremented tNext), then fall through to do something3, then increment tNext, then go round the loop and execute something2 again.
I think you would need to have a "break" at the end of each case section for this to work properly - and once you do that, it is no shorter than my original. (in fact marginally longer, because it also has the "add 1 to tNext" outside the switch).
function doIt a, b, c put 1 into tNext
repeat while tNext < 4 try switch tNext case 1 something1 a, b, c case 2 something2 a, b, c case 3 something3 a, b, c end switch catch e if e is not "123" and e is not "1234" then throw e end try
add 1 to tNext end repeat end doIt
On Mar 4, 2005, at 10:37 AM, Alex Tweedly wrote:
N wrote:
Okay this is a really strange question. I have several statements all of which could possibly "throw" a 'RR' exception. However, I would like to evaluate the error and if it was "expected" continue processing at the next statement. This would be simular to the On Error Resume Next and On Error Resume is Visual Basic 6.x. I am fully aware of try catch construct I just do not wish to wrap a try catch block around every individual method invovation.
Example expected behavior:
function doIt aParameter
try something a, b, c catch e if e Is not "123" then throw e end try
try something2 a, b, c catch e if e Is not "1234" then throw e end try
end function Prefered Behavior:
function doIt a
try something 1, 2 ,3 , 4 something1 a, b,c catch e if e is not "123" and e is not "1234" then throw e resume next end try End function
It ain't pretty, but how about (typed, not tested)
function doIt a, b, c local tNext put 1 into tNext repeat forever try switch tNext case 1 add 1 to tNext something1 a, b, c case 2 add 1 to tNext something2 a, b, c case 3 add 1 to tNext something3 a, b, c default exit repeat end switch catch e if e is not "123" and e is not "1234" then exit repeat end try end repeat
-- Alex Tweedly http://www.tweedly.net
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.6.0 - Release Date: 02/03/2005
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
- ----------------------------------------------------------- Frank D. Engel, Jr. <[EMAIL PROTECTED]>
$ ln -s /usr/share/kjvbible /usr/manual
$ true | cat /usr/manual | grep "John 3:16"
John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life.
$
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)
iD8DBQFCKIcv7aqtWrR9cZoRAkeTAJ9bqxfxSNVmaXldk7ENfbE65Z7yygCfadGW malp5k2ekxf38FF0IG3gvTE= =2oj3 -----END PGP SIGNATURE-----
___________________________________________________________ $0 Web Hosting with up to 120MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
-- Alex Tweedly http://www.tweedly.net
-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.6.0 - Release Date: 02/03/2005
_______________________________________________ use-revolution mailing list [email protected] http://lists.runrev.com/mailman/listinfo/use-revolution
