View Single Post
Old Feb 21st, 2006, 12:09 PM   #36
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by master007
example, the following psudocode:-
As DaWei rightly points out, there are better ways to get the same functionality. Refactoring your code to use the common "break" statement is simple enough:
while True:
    EvaluationCode()
    if errortype == 1:
        statements
        break
    if errortype == 2:
        statements
        break
    if errortype == 3:
        statements
        break
Although for code that seems to handle errors, exceptions would seem the best tool to use:
try:
    while True:
        EvaluationCode()
except Exception, errortype:
    if errortype == 1:
        statements
    elif errortype == 2:
        statements
    elif errortype == 3:
        statments
Arevos is offline   Reply With Quote