[futurebasic] Re: [FB] Embeded LONG IFs

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : October 1999 : Group Archive : Group : All Groups

From: Joe Lewis Wilkins <PepeToo@...>
Date: Mon, 18 Oct 1999 11:02:58 -0700
Sylvain Guillemette wrote:

> Hi,
> In my latest app, i'm facing a problem;
> I have a lot of conditional, embeded LONG IFs
> LONG IF...
>   LONG IF...
>     LONG IF...
>       LONG IF
>       And a lot more !
>       END IF
>     END IF
>   END IF
> Would it be better to just use
> IF... THEN GOTO "myLabel" ?
> "myLabel"
> This way, i eliminate the need for a lot of embeded LONG IFs.
> What do you guys and gals are doing in this situation ?

Hi Sylvain,

Most of the time this kind of situation is solved nicely with a case

SELECT CASE someStr$ (or maybe someVal%)
    CASE "whoDoneIt" :
    CASE "WhyNot"     :

When it is very complex, as yours must be, then you might use nested Case
Statements or a combination of LONG IF...XELSE...ENDIF s and Cases. The Case
Statement is much more legible than MANY nested IF THENs.

Joe Wilkins