[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Nested Ifs (was Procedures)



> Anyone want to make an argument for that vs. GOTO vs. nested IFs?

Sure.  If it is not the same variable being evaluated.  I've had this
situation but can't remember the actual variables involved.  Below is a
simplified example.  But I agree that most times if it is just reacting to
various values of #x, an evaluate is the easiest.

begin-procedure nested-ifs
If #x = 1
        !do something only if x = 1 that means you don't care about Y or Z 
anymore
        goto ENDPROC
else
        If #y = 2
                !do x=1 and y=2 thing, which means you don't care about Z 
anymore
                goto ENDPROC
        else
                !do x=1 but y <> 2 thing, but you still care about Z
        end-if

        if #z = 3
                !do x <> 1 and z = 3 thing
        else
                !do x <> 1 and z <> 3 thing
        end-if
el
end-if

ENDPROC:
end-procedure